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.
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=184.108.40.206, 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.
However, Exchange 2010 only supports PowerShell 2.0 - you can see this documented in the Exchange support matrix PowerShell section.
Also, when we look at the environments above note that there is a difference in the PowerShell versions reported.
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.