Merge pull request #1105 from anosov1960/master

Added -NoWait
This commit is contained in:
Alexander (Sasha) Nosov
2023-02-14 06:24:03 -10:00
committed by GitHub
@@ -15,7 +15,7 @@
# -All (Optional. Set the new license type value only if undefined)
#
# The script uses a function ConvertTo-HashTable that was created by Adam Bertram (@adam-bertram).
# The function was originally published in this blog: https://4sysops.com/archives/convert-json-to-a-powershell-hash-table/
# The function was originally published on this site: https://4sysops.com/archives/convert-json-to-a-powershell-hash-table/
# and used here with the author's permission.
#
@@ -171,13 +171,13 @@ foreach ($sub in $subscriptions){
if ($settings["LicenseType"] -ne $LicenseType ) {
$settings["LicenseType"] = $LicenseType
Write-Host "Resource group: [$($r.resourceGroup)] Connected machine: [$($r.MachineName)] : License type: [$($settings["LicenseType"])]"
Set-AzConnectedMachineExtension @setId -Settings $settings -NoWait
Set-AzConnectedMachineExtension @setId -Settings $settings -NoWait | Out-Null
}
}
} else {
$settings["LicenseType"] = $LicenseType
Write-Host "Resource group: [$($r.resourceGroup)] Connected machine: [$($r.MachineName)] : License type: [$($settings["LicenseType"])]"
Set-AzConnectedMachineExtension @setId -Settings $settings | Out-Null
Set-AzConnectedMachineExtension @setId -Settings $settings -NoWait | Out-Null
}
}
}