Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $output = Get-AzureRmVM | where-object {$_.LicenseType -NE "Windows_Server" -and $_.StorageProfile.osDisk.OsType -eq "Windows"} | select Name,ResourceGroupName
- $rgname = $output.Name
- foreach($item in $rgname)
- {
- $vm = Get-AzureRmVM -Name $item -ResourceGroup $output.ResourceGroupName
- $vm.LicenseType = "Windows_Server"
- Update-AzureRmVM -ResourceGroupName $item -VM $vm
- }
Add Comment
Please, Sign In to add comment