How to use PowerShell_RunCommand to execute Microsoft Exchange 2007 or 2010 PowerShell commands. (NETIQKB72385)

  • 7772385
  • 08-Jun-2010
  • 11-Nov-2011

Environment

NetIQ AppManager 7.0.1
Microsoft Exchange 2007
Microsoft Exchange 2010
Windows PowerShell 1.0
Windows PowerShell 2.0

Situation

How can I use the PowerShell_RunCommand script to execute commands for Microsoft Exchange 2007 or Microsoft Exchange 2010?

Resolution

In order to execut PowerShell commands using the PowerShell_RunCommand Knowledge Script, use the instructiosn below.

To execute PowerShell commands for Microsoft Exchange 2007, you must load the Microsoft Exchange 2007 snap-in for Windows PowerShell.  The command to load this is as follows:

  • Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin


To execute PowerShell commands for Microsoft Exchange 2010, you must load the Microsoft Exchange 2010 snap-in for Windows PowerShell.  The command to load this is as follows:

  • Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010


The "PowerShell command to run" field in the PowerShell_RunCommand Knowledge Script allows for you to enter multiple PowerShell commands using a semi-colon as the delimiter.  An example of the syntax that could be used to get the mailbox database name for Microsoft Exchange 2007 would be:

  • Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin;Get-MailboxDatabase

Additional Information

Formerly known as NETIQKB72385

If you need further assistance with the subject matter discussed in this Knowledge Base Article, please contact NetIQ Technical Support.