Guest User

Untitled

a guest
Mar 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. $output = Get-AzureRmVM | where-object {$_.LicenseType -NE "Windows_Server" -and $_.StorageProfile.osDisk.OsType -eq "Windows"} | select Name,ResourceGroupName
  2.  
  3. $rgname = $output.Name
  4. foreach($item in $rgname)
  5. {
  6. $vm = Get-AzureRmVM -Name $item -ResourceGroup $output.ResourceGroupName
  7. $vm.LicenseType = "Windows_Server"
  8. Update-AzureRmVM -ResourceGroupName $item -VM $vm
  9. }
Add Comment
Please, Sign In to add comment