0 votes

I'm attempting to build a custom PS command that will return the number of mailboxes per database in our Exchange 2010 environment. This is the script I'm using which works through Powershell

add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
(Get-MailboxDatabase) | ForEach-Object {Write-Host $_.Name (Get-Mailbox -Database $_.Name).Count}

How can I make this work through Adaxes Custom Command?

by (350 points)

1 Answer

0 votes
by (216k points)

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")
}
0

Is there anyway the output could be generated to the web interface, such as a results page or something similar?

0

Michael,

The Execution Log of the operation is displayed in the Web Interface once the operation is complete.

0

I tested and the it brought me back to Home screen with "Operation successull" displayed at the top.

What object type would my Custom Command need to be run against?

0

You should also be able to see the Execution Log below. It should look like this:

Can you post a screenshot of your Custom Command?

What object type would my Custom Command need to be run against?

It doesn't matter as the above script does not read any properties of the target object on which the Custom Command is executed.

0

I'm using the script you provided in this post as Powershell command and attempting to run in web interface

add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
(Get-MailboxDatabase) | ForEach-Object {
$message = $_.Name + ": " + (Get-Mailbox -Database $_.Name).Count
$Context.LogMessage($message, "Information")
}

0

My appologies! It is working. Ijust needed to expand the Details next to "Operation successull". Thank you very much for your assistance!

Related questions

0 votes
1 answer

We currently have two servers for Adaxes, both with 12gb of RAM and 4 virtual CPUs running on VMware ESXi. One of our servers is primarily used for scheduled tasks ... any benefit/downside to having a separated web server from the Adaxes backend servers?

asked Jul 3, 2023 by AbbyR (40 points)
0 votes
1 answer

Hallo Everyone I've seen the Report for Exchange Mailboxes with OU, Send on Behalf, Full Rights and Send As Rights: https://www.adaxes.com/questions/ ... . Example: User: Peter.Steinmann Identity: Which Mailboxes AccessRights: FullAccess Kind regards,

asked Jul 6, 2022 by Sandberg94 (340 points)
0 votes
1 answer

I'm working on user deprovision and need to re-assign a user's home directory to the manager's home directory after disabling. I found a PowerShell script on this site to ... retrieve the same for the Manager? I'm a PowerShell novice, so excuse my ignorance.

asked Feb 26, 2021 by mkvidera (60 points)
0 votes
1 answer

This article states that managment of shared mailboxes is added. https://www.adaxes.com/info_whats-new_2019.1.htm#exchange Where is the details on implementation? It seems like ... mismatch on what you say and what the software does and lack of instructions.

asked Aug 18, 2020 by ComputerHabit (790 points)
0 votes
1 answer

Let's say I have a Business Rule that is fired prior to adding members to a group. Is it possible to get the number of objects being added to that group as ... that tells me that 6 objects will be added or is each added user treated completely independently?

asked Apr 20, 2022 by ngb (290 points)
3,589 questions
3,278 answers
8,303 comments
548,133 users