![using powershell to install software using powershell to install software](https://i.stack.imgur.com/kBjv4.png)
# If all Updates have been installed and need reboot then reboot it If (($pendingpatches -eq 0) -and ($rebootpending -gt 0) -and ($approvedUpdates -eq $rebootpending))
![using powershell to install software using powershell to install software](https://byteben.com/bb/wp-content/uploads/2018/12/WMI_SU_PowerShell-1024x699.jpg)
"$system,pending patches - $pendingpatches but unable to install them ,please check Further" | Out-File $log -append Write-Verbose -Message "$system,pending patches - $pendingpatches but unable to install them ,please check Further" -Verbose "$date $system,Targeted Patches :$approvedUpdates,Pending patches:$pendingpatches,Reboot Pending patches :$rebootpending,initiated $pendingpatches patches for install" | Out-File $log -append Write-Verbose -Message "$date $system,Targeted Patches :$approvedUpdates,Pending patches:$pendingpatches,Reboot Pending patches :$rebootpending,initiated $pendingpatches patches for install" -Verbose $InstallReturn = Invoke-WmiMethod -ComputerName $system -Class CCM_SoftwareUpdatesManager -Name InstallUpdates -ArgumentList (,$MissingUpdatesReformatted) -Namespace root\ccm\clientsdk # The following is the invoke of the CCM_SoftwareUpdatesManager.InstallUpdates with our found updates $MissingUpdatesReformatted = | ForEach-Object ) $TargetedUpdates= Get-WmiObject -ComputerName $system -Namespace root\CCM\ClientSDK -Class CCM_SoftwareUpdate -Filter ComplianceState=0
USING POWERSHELL TO INSTALL SOFTWARE SOFTWARE
The key part of his code is to find the updates available in software center by Get-WmiObject: Thanks to Eswar koneti who wrote the script that install updates available in software center. In this situation, I need a PowerShell script can go through each computer in the device collection (patching group) and install updates available in software center and can reboot the computer once the installation finish. I don’t want to manually start the installation and manually reboot them one by one. But I can’t wait just wait until deadline comes because the other team still wait until I finish all patching and reboot, so they can start bring the SAP system back online. There are about 50 servers in the patching group.
USING POWERSHELL TO INSTALL SOFTWARE UPDATE
To avoid the computer start install update before they are ready, the software deployment deadline is 2 hours later than the planned time and system restart is suppressed. I only have a planned time but still need to wait until they send me an email then I can let the software updates installation start. But I have a unique situation that there is another team need to take a long process which includes many maintenance steps to make sure the whole ERP/SAP system are shutdown properly and ready for patching and reboot. Usually I can setup a deadline to force the computer to install software updates then reboot automatically. System Center Configuration Manager (SCCM) is a very popular tool to deploy software updates. Posted by Hanson on DecemDecember 18, 2018