Advertisement
guyrleech

Update Azure PowerShell Modules

May 29th, 2024
978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## update Azure PowerShell modules that have newer versions available. Run elevated since uses -Scope AllUsers
  2.  
  3. ## to just show what modules are not at the latest version, delete the code from "| Where"
  4.  
  5. Get-Module -ListAvailable az.*|sort name,version|group Name|select Name,@{n='LatestInstalled';e={$_.group[-1].version}},@{n='LatestAvailable';e={$script:latest = (find-module -Name $_.Name).Version;$script:latest}},@{n='UpdateAvailable';e={$script:latest -gt $_.group[-1].version}}|Where UpdateAvailable|% { $_.Name ;  Update-module -Name $_.Name -Scope AllUsers -Force }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement