Skip to content

Instantly share code, notes, and snippets.

@UtahCampusD
Created December 23, 2016 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UtahCampusD/18ad7a2cca514a9a98fe25f6bbcfdadc to your computer and use it in GitHub Desktop.
Save UtahCampusD/18ad7a2cca514a9a98fe25f6bbcfdadc to your computer and use it in GitHub Desktop.
Working
import salt.client
caller = salt.client.Caller()
schedules_list = caller.cmd('cmd.run', 'schtasks /query /fo list')
print schedules_list
Not working
import salt.client
caller = salt.client.Caller()
add_schedule = caller.cmd('cmd.run', 'schtasks /create /sc daily /st 14:30 /ru system /tn testtask /tr /np "C:\salt\bin\python C:\scripts\somescript.py"')
print add_schedule
Both work from windows cmd/cli
schtasks /query /fo list
schtasks /create /sc daily /st 14:30 /ru system /tn testtask /tr /np "C:\salt\bin\python C:\scripts\somescript.py"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment