0

my current version of ps is v3, however if I need to call the assembly "Microsoft.PowerShell.GraphicalHost", this assembly is part of Windows Management Framework Core, which I have installed, but still get following error Add-Type : Could not load file or assembly 'Microsoft.PowerShell.GraphicalHost, Version=1.0 .0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The sys tem cannot find the file specified. any guru could help me?

Jian_H
  • 173
  • 1
  • 4
  • 18

1 Answers1

1

I got this same error when I tried to use the Out-GridView cmdlet.

Initially, I tried loading PowerShell ISE explicitly, as described here:

Using the Out-GridView feature in PowerCLI

I gussied it up a bit for efficiency:

if ( (Get-WindowsFeature -Name PowerShell-ISE -ErrorAction SilentlyContinue ) -eq $null )
{ 
    Import-Module ServerManager; Add-WindowsFeature PowerShell-ISE
 }

I verified success:

Get-WindowsFeature PowerShell-ISE

However, I still got the same error. What's more, when I tested the code from the command line, the Out-GridView cmdlet worked!

The problem lay with Quest Software's PowerGUI Script Editor. Although I had PowerShell v.3 installed, the Script Editor was still launching with v.2. I changed my launch shortcut to use the "-version 3.0" option, resolving the problem.

Here's where I found my solution:

Thread: Can't use out-grid view since installing PowerGUI with Powershell V3

peterk411
  • 236
  • 1
  • 10