私はいくつかの Web アプリケーションの展開タスクを自動化しようとしているので、これを達成するために powershell を使用しようとしています。powershell スクリプトと .bat ファイルがあります。バッチ ファイルは、powershell スクリプトを実行するためだけに存在し、このテキストが含まれています。私はWindows 8 - 64ビットを使用しています。
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\SetupWebServer.ps1' %*
これらのコマンドを実行するpowershellスクリプトにいくつかのコードがあります:
Write-Host "Check for the existence of the Application Pool."
Import-Module WebAdministration
$iisAppPoolName = "SiteName"
$iisAppPoolDotNetVersion = "v4.0"
$iisAppName = "SiteName"
cd IIS:\AppPools\
if (!(Test-Path $iisAppPoolName -PathType Container))
{
Write-Host "Creating Application Pool"
}
CD IIS:\AppPools\ コマンドを実行すると、次のエラーが表示されます。
cd : Retrieving the COM class factory for component with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the
following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
At line:1 char:1
+ cd IIS:\AppPools\
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-Location], COMException
+ FullyQualifiedErrorId :
System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.SetLocationCommand
別の PowerShell プロンプトから、IIS:\ に cd できますが、dir コマンドを実行できず、同様のエラーが発生します。私は何が欠けていますか?