Last active
August 29, 2015 14:21
-
-
Save desek/dfe515f4ef0b14e6be15 to your computer and use it in GitHub Desktop.
Update Azure Powershell module with Powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get latest azure-powershell | |
| $AzureModule = Get-Module -Name Azure* -ListAvailable | |
| $LatestRelease = Invoke-RestMethod -Uri https://api.github.com/repos/Azure/azure-powershell/releases/latest -Method GET | |
| If (-not($AzureModule) -or $AzureModule.Version.ToString() -ne $LatestRelease.name) | |
| { | |
| $Asset = $LatestRelease.assets | Where-Object {$_.name -like "*.msi"} | |
| $OutFile = "{0}\{1}" -f $env:TEMP, $Asset.name | |
| Invoke-WebRequest -Uri $Asset.browser_download_url -OutFile $Outfile -Method Get | |
| Start-Process -FilePath msiexec.exe -ArgumentList @("/i $OutFile /qb") -Wait -PassThru | |
| } | |
| else | |
| { | |
| Write-Host "Azure Powershell module is up to date." | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment