2012-10-08 15 views
0

我當前版本的ps是v3,但是如果我需要調用程序集「Microsoft.PowerShell.GraphicalHost」,該程序集是Windows Management Framework Core的一部分,它我已安裝,但仍然出現以下錯誤添加類型:無法加載文件或程序集'Microsoft.PowerShell.GraphicalHost,版本= 1.0 .0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或它的某個依賴項。系統不能找到指定的文件。 任何古魯都可以幫助我?如何在PowerShell版本3中調用Microsoft.PowerShell.GraphicalHost

回答

1

當我嘗試使用Out-GridView cmdlet時,出現了同樣的錯誤。

起初,我試圖加載PowerShell ISE中明確,如下所述:

Using the Out-GridView feature in PowerCLI

我gussied它一點的效率:

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

我驗證成功:

Get-WindowsFeature PowerShell-ISE 

但是,我仍然有同樣的錯誤。更重要的是,當我從命令行測試代碼時,Out-GridView cmdlet起作用了!

問題在於Quest Software的PowerGUI腳本編輯器。雖然我安裝了PowerShell v.3,但腳本編輯器仍在v.2中啓動。我更改了我的啓動快捷方式以使用「-version 3.0」選項來解決問題。

這裏就是我發現我的解決方案:

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

相關問題