Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
静默安装Azure PowerShell期间出错_Powershell_Azure_Azure Powershell - Fatal编程技术网

静默安装Azure PowerShell期间出错

静默安装Azure PowerShell期间出错,powershell,azure,azure-powershell,Powershell,Azure,Azure Powershell,当我执行PowerShell脚本执行Azure PowerShell的静默安装时,它会引发以下异常: 使用“2”参数调用“DownloadInstallerFile”时出现异常:“传递到此方法的InstallerContext需要 非空InstallerFile。“ 第18行字符:5 脚本如下: [reflection.assembly]::LoadWithPartialName("Microsoft.Web.PlatformInstaller") | Out-Null $ProductMan

当我执行PowerShell脚本执行Azure PowerShell的静默安装时,它会引发以下异常:

使用“2”参数调用“DownloadInstallerFile”时出现异常:“传递到此方法的InstallerContext需要 非空InstallerFile。“ 第18行字符:5

脚本如下:

[reflection.assembly]::LoadWithPartialName("Microsoft.Web.PlatformInstaller") | Out-Null

$ProductManager = New-Object Microsoft.Web.PlatformInstaller.ProductManager
$ProductManager.Load()
$product = $ProductManager.Products | Where { $_.ProductId -eq "WindowsAzurePowerShell" }

$InstallManager = New-Object Microsoft.Web.PlatformInstaller.InstallManager

$Language = $ProductManager.GetLanguage("en")
$installertouse = $product.GetInstaller($Language)

$installer = New-Object 'System.Collections.Generic.List[Microsoft.Web.PlatformInstaller.Installer]'
$installer.Add($installertouse)
$InstallManager.Load($installer)

$failureReason=$null
foreach ($installerContext in $InstallManager.InstallerContexts) {
    $InstallManager.DownloadInstallerFile($installerContext, [ref]$failureReason)
}
$InstallManager.StartInstallation()
如何解决此问题?

可能重复的