Knil92 Posted October 20, 2017 Posted October 20, 2017 Hey, So I found this syntax example on a microsoft website for schtasks (https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true) schtasks /create /tn TaskName /tr TaskRun /sc minute [/mo {1 - 1439}] [/st StartTime] [/sd StartDate] [/ed EndDate] [/s computer [/u [domain\]user /p password]] It goes into a bit more detail on the webpage but I was wondering if any one knows how to set it so it creates the scheduled task with the highest privileges and run whether a user is logged in as it doesn't have that on any of the examples. Thanks in advance
Steve21 Posted October 20, 2017 Posted October 20, 2017 /rl highest And as long as you're using /ru etc it'll do not logged in anyway Steve 1
Knil92 Posted October 25, 2017 Author Posted October 25, 2017 Just in case any one else comes across this issue. When you have an executable or a batch script some where that has spaces in the path, there's a weird little thing you need to do. So normally you would expect it to be something like; SchTasks /Create /RL HIGHEST /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN "SQLBackup" /TR "D:\Program Files\Microsoft SQL Server\MSSQL12.SIMS2014\MSSQL\binn\sqlbackups.bat" /ST 01:00 /ru user.name /rp password The above won't work, you need to add in a a couple extra " and a \ so that it looks like; SchTasks /Create /RL HIGHEST /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN "SQLBackup" /TR ""D:\Program Files\Microsoft SQL Server\MSSQL12.SIMS2014\MSSQL\binn\sqlbackups.bat"" /ST 01:00 /ru user.name /rp password This creates the scheduled task pointing to the path enclosed with " and means that it works perfectly fine. Just thought I would post this on here in case any one else comes across it.
Knil92 Posted October 30, 2017 Author Posted October 30, 2017 SchTasks /Create /RL HIGHEST /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN "SQLBackup" /TR ""D:\Program Files\Microsoft SQL Server\MSSQL12.SIMS2014\MSSQL\binn\sqlbackups.bat"" /ST 01:00 /ru user.name /rp password That is meant to be; SchTasks /Create /RL HIGHEST /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN "SQLBackup" /TR ""D:\Program Files\Microsoft SQL Server\MSSQL12.SIMS2014\MSSQL\binn\sqlbackups.bat"" /ST 01:00 /ru user.name /rp password with the ""D:\ the backslash before the file path is pretty important lol
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now