2015-11-22 99 views
2

我正在嘗試安裝最新的Azure PowerShell(2015年11月9日發佈)。如果我嘗試使用Web平臺安裝程序安裝它,我得到以下錯誤:無法安裝最新的Azure PowerShell

Azure Modules from the PowerShell Gallery are installed on this machine. Please remove these modules before installing this MSI.

如果我在PowerShell中運行Get-InstalledModule,我看到模塊Azure(0.9.11版本)安裝。所以我嘗試使用PowerShell命令Uninstall-Module Azure進行卸載。在這裏我得到以下錯誤:

PackageManagement\Uninstall-Package : The property 'ModuleBase' cannot be found on this object. Verify that the 
property exists. 
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\PSGet.psm1:1351 char:21 
+ ...  $null = PackageManagement\Uninstall-Package @PSBoundParameters 
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], 
    Exception 
    + FullyQualifiedErrorId : PropertyNotFoundStrict,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage 

回答

3

好的,我解決了我的問題。愚蠢的錯誤:我沒有作爲管理員運行Uninstall-Module Azure。一旦我使用管理員權限啓動PowerShell,卸載舊的Azure PowerShell就沒有問題了。

嗯,希望能看到在這種情況下;-)

0

一個更具描述性錯誤消息,我打的是同樣的問題,但並沒有什麼天青相關,當我執行Get-InstalledModule出現。

如果您在powershell提示符下執行$env:PSModulePath,它會列出您所有的模塊路徑位置,導航到其中的每個路徑位置,並刪除與a​​zure相關的任何內容,您應該能夠安裝新的azure powershell cmdlet。