Add exclusion for macOS-12 for Action: restart (#7511)

This commit is contained in:
Alexey-Ayupov
2023-04-28 10:35:14 +02:00
committed by GitHub
parent 9f5b4b2fd3
commit a67e67d42e

View File

@@ -86,7 +86,11 @@ function Invoke-SoftwareUpdate {
Install-SoftwareUpdate -HostName $ipAddress -listOfUpdates $listOfNewUpdates | Show-StringWithFormat
# Check if Action: restart
if ($newUpdates.Contains("Action: restart")) {
# Make an array of updates
$listOfNewUpdates = $newUpdates.split('*').Trim('')
foreach ($newupdate in $listOfNewUpdates) {
# Will be True if the value is not Venture, not empty, and contains "Action: restart" words
if ($newupdate.Contains("Action: restart") -and !$newupdate.Contains("macOS Ventura") -and (-not [String]::IsNullOrEmpty($newupdate))) {
Write-Host "`t[*] Sleep 60 seconds before the software updates have been installed"
Start-Sleep -Seconds 60
@@ -99,11 +103,12 @@ function Invoke-SoftwareUpdate {
# Check software updates have been installed
$updates = Get-SoftwareUpdate -HostName $ipAddress
if ($updates.Contains("Action: restart")) {
Write-Host "`t[x] Software updates failed to install: $updates"
Write-Host "`t[x] Software updates failed to install: "
Show-StringWithFormat $updates
exit 1
}
}
}
Write-Host "`t[*] Show the install history:"
$hUpdates = Get-SoftwareUpdateHistory -HostName $ipAddress