0 votes

How do I script my custom command to display the output in the web interface?

For instance, I need to see the output of the following Exchange 2010 cmdlet in the web interface.

add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
Get-MailboxDatabase | Get-MailboxDatabaseCopyStatus

by (350 points)

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello Michael,

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. The execution log of the Custom Command will be displayed in Adaxes Web Interface once the Custom Command is executed.

So, to output the information that is returned by the Get-MailboxDatabaseCopyStatus cmdlet, you need to pass the collection of database copy status entries that this cmdlet returns into a foreach loop and output information on each entry as a separate log entry. Here's a sample script that you can use:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
$databaseCopyStatuses = Get-MailboxDatabase | Get-MailboxDatabaseCopyStatus
foreach ($databaseCopyStatus in $databaseCopyStatuses)
{
    $logMessage = $databaseCopyStatus.Name + " : " + $databaseCopyStatus.Status + " ; " `
                  + $databaseCopyStatus.CopyQueueLength + " ; " + $databaseCopyStatus.CopyQueueLength + " ; "`
                  + $databaseCopyStatus.ReplayQueueLength + " ; " + $databaseCopyStatus.LastInspectedLogTime`
                  + " ; " + $databaseCopyStatus.LastInspectedLogTime + " ; " + $databaseCopyStatus.ContentIndexState
    $Context.LogMessage($logMessage, "Information")
}

For more information on the properties of a database copy status entry that you can get, see the description of the DatabaseCopyStatusEntry Class on MSDN.

0

Thank you! This worked!

0

Is this still possible in 2019.1? I'm trying this but unable to see any output when I'm setting the LogMessage to Information. If I use Warning or Error it outputs, but this makes the end-user think there was a problem. I can see the information log output if I go into the administration console and logging, but there is no output in the web interface after the end user triggers the custom command.
Thanks!

0

Answered my own question! Found the following settings in the web interface configuration tool. Changed from default of "only if it contains errors or warnings" to "always". Hope this helps someone else!

Related questions

0 votes
1 answer

In the web interface, I would like to display the "Distinguished Name" property but it is not showing it as it would when using ADUC or even in the Adaxes Admin Console. Is ... I would like it to display like this: CN=Mark Smith,OU=Sales,DC=Fabrikam,DC=COM

asked Jan 15, 2020 by mark.it.admin (2.3k points)
0 votes
1 answer

When we create a new user in Adaxes, we can select the job title in a dropdown because we have defined it in the property pattern. Now I would like to create a custom ... How can I bring the same dropdown from "create user" into my custom command? Thank you!

asked Sep 25, 2023 by DRiVSSi (320 points)
0 votes
1 answer

Is it possible to grant selected user option to add custom license plan (or just subset of its licenses) to given user(s) using web interface?

asked Feb 28, 2023 by KIT (960 points)
0 votes
1 answer

To the left of the user object there are several custom commands showing. I don't want our service desk to see them. Why are they showing? How do I remove them. Must be something simple. They only see these when looking at a user Object.

asked Jan 17 by mightycabal (1.0k points)
0 votes
1 answer

Hi, I had to create Custom Command for distribution group creation. Default group creation wizard cannot be used, because we need some of parameters to be mandatory etc. Anyway I ... which shouldn't be targeted to any particular AD object. How do I do it?

asked Jan 20, 2020 by KIT (960 points)
3,588 questions
3,277 answers
8,303 comments
548,082 users