Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When you perform certain operations in the Exchange Management Console GUI a window appears showing the PowerShell command that was executed to perform the operation. This is useful for learning how to create a PowerShell script to do the same thing.

Is there a way to get the PowerShell commands that execute for minor operations in Exchange like when just changing various attirbutes in a property dialog?

From some of the answers I can tell my question is not clear. I am referring to the Exchange Management Console which has a GUI not the PowerShell based Exchange Management Shell. In the Console, when you perform operations that use a wizard like adding new users, the final dialog show a text box with the PowerShell command that was executed in the background. I am wondering if it is possible to get those commands when performing minor operation in the GUI.

share|improve this question
add comment

4 Answers 4

up vote 1 down vote accepted

The Exchange Management Shell will log all of the PowerShell commands it executes if you set a registry key that enables logging. The commands will be logged to the Event Viewer in the PowerShell folder.

The key can be set by navigating to:

HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.Exchange.Management.PowerShell.Admin

using Regedit and creating a string value named LogpipelineExecutionDetails with a value of "1".

This registry value can also be created using the following PowerShell command:

Set-ItemProperty HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.Exchange.Management.PowerShell.Admin -Name LogpipelineExecutionDetails -value 1

share|improve this answer
add comment

You can run the get-member command on any item in Powershell, to get all the properties and operations for the object, for example the command below will show you all the attributes, properties and operations available on a mailbox:

get-mailbox bob | get-member

You can get a list of all Exchange Powershell commands on Technet.

share|improve this answer
add comment

get-excommand

you will see information on 368 cmdlets. You can confirm that using the command:

(get-excommand).count

To add some focus to your search for relevant Exchange commands use wildcards with the get-command cmdlet. For example, to find cmdlets relevant to POP3 configuration type

*get-command *pop**

which returns information on any cmdlet whose name includes the character sequence pop. The relevant commands are displayed."

Anapologetos

Source

share|improve this answer
add comment

You may want to use the "set-user" command. An example from a script I have:

set-user -Identity "CN=$displayName,CN=Users,DC=contoso,DC=edu" -City $City -Department "$department"-Office $office -Phone "$phone" -StreetAddress "$POBox`r`n$Office`r`n$Department" -StateOrProvince $State -PostalCode $ZipCode
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.