我有天青PowerShell的1.0.3通过画廊装(每说明这里在安装Azure中的PowerShell从图库一节)。我想更新到最新版本,但不清楚我需要运行的命令。我尝试了以下操作,但是决定询问而不是潜在地破坏我的安装:
PS C:\Windows\system32> Install-Module AzureRM
You are installing the module(s) from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet.
Are you sure you want to install software from 'https://www.powershellgallery.com/api/v2/'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
WARNING: Version '1.0.3' of module 'AzureRM' is already installed at 'C:\Program
Files\WindowsPowerShell\Modules\AzureRM\1.0.3'. To delete version '1.0.3' and install version '1.1.0', run
Install-Module, and add the -Force parameter.
有人可以提供脚本来更新Azure PowerShell吗?
您需要运行的命令在您发布的帮助文本中。使用Install-Module -Force AzureRM
。参见-Force
标签。
更新引导程序后,请运行Install-AzureRM
以安装新软件包。
PowerShell具有Update-Module AzureRM
执行与相似的活动的功能Install-Module -Force AzureRM
。如果您已经在本地环境中定义了AzureRM会覆盖的-AllowClobber
函数,Install-Module
则可能还需要使用参数。
但是,两者都不会更新您的当前环境,因此在运行之前Install-AzureRM
,请检查是否已加载了最新的AzureRM模块。例如,如果要从1.0.1更新到1.0.3:
$ Get-Module AzureRM
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0.1 AzureRM {...}
$ Update-Module AzureRM
$ # This will still be old because we haven't imported the newer version.
$ (Get-Module AzureRM).Version.ToString()
1.0.1
$ Remove-Module AzureRM
$ Import-Module AzureRM
$ (Get-Module AzureRM).Version.ToString()
1.0.3
$ Install-AzureRM
或者,您可以在运行更新后仅打开一个新的PowerShell窗口。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句