Last active
July 4, 2018 08:15
-
-
Save DarkAllien/cb2d3aff2ed2e68a29ffe0cfd5647029 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
$time = Get-Date | |
"$time - CI.SQL.Servers.AppEval - Evaluation - Creating Application Evaluation Schedulled Task" | out-file "$env:windir\Logs\CB.SQL.Servers.Updates.log" -Append | |
Unregister-ScheduledTask -TaskName SCCMAppEval -Confirm:$False -ErrorAction Ignore | Out-Null | |
$taskname = "SCCMAppEval" | |
$taskdescription = "SCCMAppEval" | |
$action = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument "-Noprofile -Windowstyle Hidden -command & {Invoke-WmiMethod -Namespace root\ccm -Class sms_client -Name TriggerSchedule -ArgumentList '{00000000-0000-0000-0000-000000000121}'}" | |
$trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay (New-TimeSpan -minutes 10) | |
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Minutes 5) -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1) | |
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $taskname -Description $taskdescription -Settings $settings -User "System" -RunLevel Highest | Out-Null | |
return $true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment