I have a script that I’ve put together (with LOTS of help) that assists in joining new computers to a domain. The first part of the script (below) installs an update that enables PowerShell to add the computer to particular security groups in Active Directory:
Write-host 'Preparing to Join Domain, Please Wait' wusa.exe c:windowssetupscriptsWindowsTH-RSAT_WS2016-x64.msu /quiet /norestart /log:$homeDocumentsRSAT.log do { Write-Host "." -NoNewline Start-Sleep -Seconds 3 } until (Get-HotFix -Id KB2693643 -ErrorAction SilentlyContinue) Write-Host "."
What I’d like to do is check if the updates installed first and if it is, continue with the rest of the script. If it isn’t then I’d like it to install and then continue. Can anyone advise how I’d go about doing this?
submitted by /u/saint_david
[link] [comments]
The post How to check if update is installed and install only if necessary? appeared first on How to Code .NET.