我正在尝试编写一个 PowerShell 脚本来自动执行 IIS 网站部署。我尝试在 Windows Server 2008 R2 计算机上运行脚本,32 位:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
每当我运行如下 Web 管理命令时:
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,这对我来说是不行的。
知道我该如何克服这个问题吗?提前致谢。
Running:
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
实际上加载了32 bitpowershell 版本;-)
这显然不是你想要的。运行system32中的版本以获得64位版本。对真的。
您可以像这样验证这一点:
ps> [intptr]::size
4
如果返回 4,则它是 32 位。 64 位 powershell 将返回 8。
-Oisin
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)