静默安装Azure PowerShell期间出错
当我执行PowerShell脚本执行Azure PowerShell的静默安装时,它会引发以下异常: 使用“2”参数调用“DownloadInstallerFile”时出现异常:“传递到此方法的InstallerContext需要 非空InstallerFile。“ 第18行字符:5 脚本如下:静默安装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
[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()
如何解决此问题?可能重复的