Powershell – How to get Exchange 2007 PowerShell commands for property changes

exchange-2007powershell

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.

Best Answer

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