Powershell-CLSID由于以下错误而失败:80040154类未注册
我在执行Jenkins作业中的低于PS脚本时出错。若我从服务器手动执行,相同的脚本运行良好。 我的剧本在做什么- 我需要检查IIS中是否存在站点。如果退出,那么我需要执行PS脚本如果没有,那么我需要创建一个新的同名IIS网站并执行PS脚本 我的PS脚本是Powershell-CLSID由于以下错误而失败:80040154类未注册,powershell,jenkins,Powershell,Jenkins,我在执行Jenkins作业中的低于PS脚本时出错。若我从服务器手动执行,相同的脚本运行良好。 我的剧本在做什么- 我需要检查IIS中是否存在站点。如果退出,那么我需要执行PS脚本如果没有,那么我需要创建一个新的同名IIS网站并执行PS脚本 我的PS脚本是 Import-Module WebAdministration Function WAPublish { Param( [parameter(Mandatory=$true)] [String] $RELEASEDIR,
Import-Module WebAdministration
Function WAPublish
{
Param(
[parameter(Mandatory=$true)]
[String]
$RELEASEDIR,
[parameter(Mandatory=$true)]
[String]
$DESTINATION,
[parameter(Mandatory=$true)]
[String]
$SERVER,
[parameter(Mandatory=$true)]
[String]
$SITE,
[parameter(Mandatory=$true)]
[String]
$HostName,
[parameter(Mandatory=$true)]
[String]
$PhysicalPath
)
if(Test-Path IIS:\Sites\$site)
{
Write-Host "The provided website name is $site and it is a valid website`r`n" -ForegroundColor Cyan
Get-ChildItem "$RELEASEDIR\*"
Copy-Item "$RELEASEDIR\*" "\\$SERVER\$DESTINATION" -Force -Recurse
Write-Host "Deployment completed"
invoke-command -computername "$SERVER" -scriptblock {iisreset /RESTART}
}
else
{
Write-Host "There is not a website present in the name provided`r`n" -ForegroundColor Red
New-Item iis:\Sites\$SITE -bindings @{protocol="http";bindingInformation=":80:$HostName"} -physicalPath $PhysicalPath
Get-ChildItem "$RELEASEDIR\*"
Copy-Item "$RELEASEDIR\*" "\\$SERVER\$DESTINATION" -Force -Recurse
Write-Host "Deployment completed"
invoke-command -computername "$SERVER" -scriptblock {iisreset /RESTART}
Exit
}
if ($error) { exit 1 }
}
WAPublish -RELEASEDIR "C:\Location" -DESTINATION "c$\test" -SERVER "$env:WEBAPISERVER" -SITE "$env:SITE" -HostName "$env:HOSTNAME" -PhysicalPath "C:\test"
错误日志-
Time Elapsed 00:00:14.68
[BTP] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Users\ADMINI~1\AppData\Local\Temp\hudson5229396596966613327.ps1'"
Test-Path : Cannot retrieve the dynamic parameters for the cmdlet. 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 C:\Release\RPCPS\WebApiPublish-2.ps1:24 char:4
+ if(Test-Path IIS:\Sites\$site)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Test-Path], ParameterBindingException
+ FullyQualifiedErrorId : GetDynamicParametersException,Microsoft.PowerShell.Commands.TestPathCommand
Test-Path : Cannot retrieve the dynamic parameters for the cmdlet. 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 C:\Release\RPCPS\WebApiPublish-2.ps1:24 char:4
+ if(Test-Path IIS:\Sites\$site)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Test-Path], ParameterBindingException
+ FullyQualifiedErrorId : GetDynamicParametersException,Microsoft.PowerShell.Commands.TestPathCommand
这看起来是一个类似的问题:因此,问题可能是您需要使用32位PowerShell而不是64位PowerShell。我应该如何使用Jenkins Job执行此操作?我不是Jenkins专家,但我认为这与Jenkins slave是以32位还是64位运行有关。您可能需要执行与描述相反的操作这里:@Mark我无法跟进你提到的帖子。你能在这里帮我一下吗?或者帮我做一些更精确的步骤,这样我就可以照着做了。