Created
May 24, 2019 12:42
-
-
Save CodyMathis123/42409f48682743e23570ca971a1a9f00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
powershell.exe -command "&{$TimeFrame=(Get-Date).AddMinutes(-17);$Filter=@{LogName='System';StartTime=$TimeFrame;Id='19';ProviderName='Microsoft-Windows-WindowsUpdateClient';};$Events=Get-WinEvent -FilterHashtable $Filter;foreach($Event in $Events){switch -Regex ($Event.Message){'Servicing Stack Update'{foreach($Schedule in @('108','113')){$ScheduleString = [string]::Format('{{00000000-0000-0000-0000-000000000{0}}}',$Schedule);$invokeWmiMethodSplat=@{Name='TriggerSchedule';Namespace='root\ccm';Class='sms_client';ArgumentList=$ScheduleString;ErrorAction='Stop';};Invoke-WmiMethod @invokeWmiMethodSplat;}}}}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment