Michael,
The Write-Host function is not supported in Adaxes actions, however if you want to output some information, you can add a record to the Execution Log of the operation using the $Context.LogMessage method. For more information, see ExecuteScriptContext.
Here's a modified version of your script that can be used with Custom Commands, Business Rules and Scheduled Tasks using the Run a program or PowerShell script action:
add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
(Get-MailboxDatabase) | ForEach-Object {
$message = $_.Name + ": " + (Get-Mailbox -Database $_.Name).Count
$Context.LogMessage($message, "Information")
}