Piping to Out-GridView on a Server 2008 R2 (PowerShell ISE is not installed by default) confirmed that Out-GridView cmdlet requires PowerShell ISE:
get-process | select name,id | out-gridview 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=neu tral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.) At line:1 char:27 + get-process | select name,id | out-gridview <<<< + CategoryInfo : ObjectNotFound: (Microsoft.Power...1bf3856ad364e35:AssemblyName) [Out-GridView], NotSupp ortedException + FullyQualifiedErrorId : ErrorLoadingAssembly,Microsoft.PowerShell.Commands.OutGridViewCommand
After some troubleshooting I discovered that this can be resolved easily by installing PowerShell ISE, which is an optional feature and requires .Net 3.5 SP1. To install this on Windows Server 2008 R2, use the Add Features Wizard or run the following Powershell command:
Import-Module ServerManager; Add-WindowsFeature PowerShell-ISE
1 comment:
Wow can't believe I took so long to find this. No more need for if (Get-Command out-gridview) in my scripts
Post a Comment