PoshCode Logo PowerShell Code Repository

Force WSUS Check by Brian 3 years ago (modification of post by St3v3o view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/4385"></script>download | new post

Remotely force WSUS Check on Servers within your network. Powershell remoting must be enabled.

  1. # Powershell Script to force clients check into WSUS server
  2.  
  3. # Import Active Directory PS Modules CMDLETS
  4. Import-Module ActiveDirectory
  5.  
  6. $comps = Get-ADComputer -Filter {operatingsystem -like "*server*"}
  7.  
  8. $cred = Get-Credential
  9.  
  10. Foreach ($comp in $comps) {
  11.  
  12. Invoke-Command -computername $comp.Name -credential $cred { wuauclt.exe /detectnow }
  13. Write-Host Forced WSUS Check-In on $comp.Name
  14.  
  15. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me