0

Using Out-GridView With Exchange 2010 PowerShell

Using Out-GridView with Exchange 2010 will result in an error.  This happens running the commands directly in the Exchange Management Shell or using the Out-GridVew as part of a script.

Some examples:

Exchange 2010 Management Shell With Our-GridView Error

Exchange 2010 Management Shell With Our-GridView Error With Script

The below is the typical error received:

Out-GridView : To use the Out-GridView cmdlet, install the Windows PowerShell Integrated Scripting Environment feature from Server Manager. (Could not load file or assembly 'Microsoft.PowerShell.GraphicalHost, Version=1.0.0.0, Culture=neutral, PublicKeyToken
=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.)
At C:ScriptsCheck-CAS-NameSpaces-1.0.ps1:108 char:23
+ $Output | Out-GridView <<<<
+ CategoryInfo          : ObjectNotFound: (Microsoft.Power…1bf3856ad364e35:AssemblyName) [Out-GridView], NotSupportedException
+ FullyQualifiedErrorId : ErrorLoadingAssembly,Microsoft.PowerShell.Commands.OutGridViewCommand

Oh, But Why?

Out-GridView was not part of the PowerShell 1.0 or 2.0 release and was first added in PowerShell 3.0 .  The Exchange server above does have the newer PowerShell installed as this is Exchange 2010 on Windows Server 2012.

We can see this by running an example command in standard Windows PowerShell.

Windows PowerShell - Out-GridView Is Available

However, Exchange 2010 only supports PowerShell 2.0  - you can see this documented in the Exchange support matrix PowerShell section.

Exchange 2010 PowerShell Support Policy

Also, when we look at the environments above note that there is a difference in the PowerShell versions reported.

Windows PowerShell - PowerShell 4

Exchange 2010 Management Shell - PowerShell 4

While you may see posts and references to updating the Exchange Management Shell shortcut this is not something that will have been tested or supported by the Exchange product group.

Cheers,

Rhoderick

Rhoderick Milne [MSFT]

Leave a Reply

Your email address will not be published. Required fields are marked *