File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -100,14 +100,14 @@ function Invoke-SoftwareUpdate {
100100 $command = " sw_vers"
101101 $guestMacosVersion = Invoke-SSHPassCommand - HostName $ipAddress - Command $command
102102 switch - regex ($guestMacosVersion [1 ]) {
103- ' 12.\d' { $nextOSVersion = ' macOS Ventura' }
103+ ' 12.\d' { $nextOSVersion = ' macOS Ventura|macOS Sonoma ' }
104104 ' 13.\d' { $nextOSVersion = ' macOS Sonoma' }
105105 }
106106 # Make an array of updates
107107 $listOfNewUpdates = $newUpdates.split (' *' ).Trim(' ' )
108108 foreach ($newupdate in $listOfNewUpdates ) {
109109 # Will be True if the value is not Venture, not empty, and contains "Action: restart" words
110- if ($newupdate.Contains (" Action: restart" ) -and ! $newupdate.Contains ( " $nextOSVersion " ) -and (-not [String ]::IsNullOrEmpty($newupdate ))) {
110+ if ($newupdate.Contains (" Action: restart" ) -and ! ( $newupdate -match $nextOSVersion ) -and (-not [String ]::IsNullOrEmpty($newupdate ))) {
111111 Write-Host " `t [*] Sleep 120 seconds before the software updates have been installed"
112112 Start-Sleep - Seconds 120
113113
@@ -119,7 +119,7 @@ function Invoke-SoftwareUpdate {
119119
120120 # Check software updates have been installed
121121 $updates = Get-SoftwareUpdate - HostName $ipAddress
122- if ($updates.Contains (" Action: restart" ) -and ! $updates .Contains ( " $ nextOSVersion" )) {
122+ if ($updates.Contains (" Action: restart" ) -and ! ( $newupdate -match $ nextOSVersion )) {
123123 Write-Host " `t [x] Software updates failed to install: "
124124 Show-StringWithFormat $updates
125125 exit 1
You can’t perform that action at this time.
0 commit comments