2

我正在尝试使用 powershell 安装 Azure cmdlet,而不是 Microsoft 提供的向导。

这是因为我的脚本(具有 Azure cmdlet)将用于位于 Azure 中的新虚拟机,如果我的脚本尝试运行 Azure 的某些 cmdlet,肯定会失败。

我想将 powershell cmdlet 的安装行放在我的脚本顶部以安装整个 cmdlet,然后我的脚本可以毫无问题地执行其他 cmdlet。

那么,有人知道吗?

谢谢!

4

1 回答 1

2

如果您在 VM 中有 Web 平台安装程序,则可以使用我在 PowerShell Magazine 上发布的脚本。

http://www.powershellmagazine.com/2014/02/27/using-powershell-and-web-platform-installer-to-install-azure-powershell-cmdlets/

或者从https://github.com/Azure/azure-sdk-tools/releases获取 Windows Standalone 安装程序并使用 msiexec 进行安装。

如果您也想使用 PowerShell 下载最新版本:

您可以使用Invoke-WebRequest阅读页面(https://github.com/Azure/azure-sdk-tools/releases),然后从中获取所有链接。然后,您可以获得所有以 .msi 结尾的链接并获取第一个链接进行下载。

#Code not tested
$doc = Invoke-WebRequest 'https://github.com/Azure/azure-sdk-tools/releases' 
$links = $doc.Links.Href
于 2014-05-31T10:18:47.270 回答