我正在尝试编写一个 PowerShell 脚本来自动化我的 IIS 网站部署。我正在尝试在我的 Windows Server 2008 R2 机器上运行脚本,在 32 位以下:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
每当我运行这样的 WebAdministration 命令时:
Get-Website -Name "MYWebsite"
我收到这样的错误:
Get-Website : Retrieving the COM class factory for component with CLSID {688EEE
E5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154.
At line:1 char:12
+ Get-Website <<<< -Name "MyWebsite"
+ CategoryInfo : NotSpecified: (:) [Get-Website], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Micr
osoft.IIs.PowerShell.Provider.GetWebsiteCommand
切换到 64 位版本的 PowerShell.exe 解决了这个问题,但我无法同时使用 Microsoft Team Foundation Server 2008 Power Tools PSSnapin,这对我来说是不行的。
知道如何克服这个问题吗?提前致谢。