Hi all I am having the following script which updates the software remotely
$path= 'c:\mysw-x64.msu' #c:\_temp\W2K12-KB3134759-x64.msu
Invoke-Command -Session $psSession -ArgumentList $path-ScriptBlock { param($path)
$SB1={
Start-Process -FilePath 'wusa' -ArgumentList "$path /extract:c:\updates" -wait -PassThru
$SB2={
Start-Process -FilePath 'dism' -ArgumentList "/online /add-package /PackagePath:c:\updates /IgnoreCheck /Quiet" -PassThru -wait
}
Invoke-Command -ScriptBlock $SB1
Invoke-Command -ScriptBlock $SB2
}
This executes fine and system is getting restarted but I need to check whether it actually restarts or any issues while updating is it possible to do so or if it successfully restarts I need a return code