我想编写一份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,这对我来说是不可行的。您有什么想法可以克服这个问题吗?谢谢。