tedhyu
asked on
NT AUTHORITY\SYSTEM
Hey everyone:
If i use the "at" command to schedule a task, the "RUN AS" user is set as NT AUTHORITY\SYSTEM by default. Is there a way to schedule a task with an "at" command and have the "RUN AS" user to be the XP user, for example: mycomputer\ted?
Otherwise, is there a way to make toggle "NT AUTHORITY\SYSTEM" to be able to access a networked computer?
Thanks for any comments.
If i use the "at" command to schedule a task, the "RUN AS" user is set as NT AUTHORITY\SYSTEM by default. Is there a way to schedule a task with an "at" command and have the "RUN AS" user to be the XP user, for example: mycomputer\ted?
Otherwise, is there a way to make toggle "NT AUTHORITY\SYSTEM" to be able to access a networked computer?
Thanks for any comments.
For the user-query side of things...
Do you need it to be command-line? The Control Panel's Scheduled Tasks will allow you access to the user, etc for a scheduled task much simpler.
Unless another expert has a better answer, you can "at" a batch file which contains a "runas" with the correct parameters by command-line.
Do you need it to be command-line? The Control Panel's Scheduled Tasks will allow you access to the user, etc for a scheduled task much simpler.
Unless another expert has a better answer, you can "at" a batch file which contains a "runas" with the correct parameters by command-line.
Try the "schtasks" command if you have to "run as a specific person".
Review this thread that I answered that covers the same topic...
https://www.experts-exchange.com/questions/21358960/Scheduled-task-via-command-line.html#13595350
************************** ********** ********** ********** ********** **
A simple AT command should suffice unless you have to run it as the Administrator and can not run as the system account.
AT 14:20 /every:t,th "c:\prlit\launch.bat"
Otherwise if you have to have it run as the Administrator you can do this;
schtasks /create /tn PRLAUDIT /tr c:\prlit\launch.bat /sc weekly /mo 1 /d tue,thu /st 14:20:00 /ru administrator /rp passwor
d
This will schedule it to run every week on Tuesday and Thursday at 2:20 pm as the local administrator.
Review this thread that I answered that covers the same topic...
https://www.experts-exchange.com/questions/21358960/Scheduled-task-via-command-line.html#13595350
**************************
A simple AT command should suffice unless you have to run it as the Administrator and can not run as the system account.
AT 14:20 /every:t,th "c:\prlit\launch.bat"
Otherwise if you have to have it run as the Administrator you can do this;
schtasks /create /tn PRLAUDIT /tr c:\prlit\launch.bat /sc weekly /mo 1 /d tue,thu /st 14:20:00 /ru administrator /rp passwor
d
This will schedule it to run every week on Tuesday and Thursday at 2:20 pm as the local administrator.
ASKER
Do you need it to be command-line? The Control Panel's Scheduled Tasks will allow you access to the user, etc for a scheduled task much simpler.
-> This is called using a "system" command in Perl, so it's the only way i can find to schedule in Perl.
simply specify the computer you want the command to run on using the "\\computername" option.
-> I specified the computername option, and the "RUN AS" is still "NT AUTHORITY\SYSTEM" Here is my dos command.
C:\Documents and Settings\Ted Yu>at \\sheeba 9:27AM /interactive "c:\program files\btix\upload.exe"
-> This is called using a "system" command in Perl, so it's the only way i can find to schedule in Perl.
simply specify the computer you want the command to run on using the "\\computername" option.
-> I specified the computername option, and the "RUN AS" is still "NT AUTHORITY\SYSTEM" Here is my dos command.
C:\Documents and Settings\Ted Yu>at \\sheeba 9:27AM /interactive "c:\program files\btix\upload.exe"
You don't want it to run under the system account?
at \\sheeba 9:27AM /interactive "c:\program files\btix\upload.exe"
would become this
schtasks /create /tn sheeba /tr "c:\program files\btix\upload.exe" /sc weekly /mo 1 /d tue,thu /st 09:27:00 /ru "sheeba\logon id that you want to use" /rp "your password"
/tn is used to name the scheduled job, these jobs will also should in scheduled tasks and you can also open and edit them via the gui if you choose to.
The /sc is how you want to schedule it, daily weekly monthly or once etc..
/mo is a modifier that allows you to control how often the /sc runs like twice a week etc..
/d when used with the /sc weekly lets you specify which days to run on like every tuesday etc..
/st is the start time of the task and is a 24 hour clock
/ru is used to specify the id you want to use to run the command with.
/rp is used to spedify the password for the id
would become this
schtasks /create /tn sheeba /tr "c:\program files\btix\upload.exe" /sc weekly /mo 1 /d tue,thu /st 09:27:00 /ru "sheeba\logon id that you want to use" /rp "your password"
/tn is used to name the scheduled job, these jobs will also should in scheduled tasks and you can also open and edit them via the gui if you choose to.
The /sc is how you want to schedule it, daily weekly monthly or once etc..
/mo is a modifier that allows you to control how often the /sc runs like twice a week etc..
/d when used with the /sc weekly lets you specify which days to run on like every tuesday etc..
/st is the start time of the task and is a 24 hour clock
/ru is used to specify the id you want to use to run the command with.
/rp is used to spedify the password for the id
ASKER
You don't want it to run under the system account?
-> The system account does not have permission to access a file on a networked computer. I need the program to access a file on a network computer.
-> The system account does not have permission to access a file on a networked computer. I need the program to access a file on a network computer.
ASKER
I ran this in dos:
C:\Documents and Settings\Ted Yu>schtasks /create /tn sheeba /tr "c:\program fil
es\btix\upload.exe" /sc weekly /mo 1 /d tue,thu /st 09:46:00 /ru "sheeba\ted yu"
/rp "mypassword"
SUCCESS: The scheduled task "sheeba" has successfully been created.
When it ran, it was unsuccessful. The comment on the scheduled task folder says "could not start". What am I doing wrong?
C:\Documents and Settings\Ted Yu>schtasks /create /tn sheeba /tr "c:\program fil
es\btix\upload.exe" /sc weekly /mo 1 /d tue,thu /st 09:46:00 /ru "sheeba\ted yu"
/rp "mypassword"
SUCCESS: The scheduled task "sheeba" has successfully been created.
When it ran, it was unsuccessful. The comment on the scheduled task folder says "could not start". What am I doing wrong?
open up the gui scheduled task and see what the return code is or you can view the event viewer. More than likely the "sheeba\ted yu" is wrong as I think the "sheeba" is the local computer name and for network access you need the "domain" name there.
I believe Dowwie has the best option for you. I've tried a few different ways of piping a password to the "runas" command to launch the AT command, and have not met with much success. It keeps prompting for a password.
:o)
Bartender_1
:o)
Bartender_1
ASKER
Is there a way to do this without a password login?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
open up the gui scheduled task and see what the return code is or you can view the event viewer. More than likely the "sheeba\ted yu" is wrong as I think the "sheeba" is the local computer name and for network access you need the "domain" name there.
-> The comment code was 0x0
When using the "at" command, i have to turn on the /interactive switch for it to run an .exe program. Is this the case with the schtask command as well?
-> The comment code was 0x0
When using the "at" command, i have to turn on the /interactive switch for it to run an .exe program. Is this the case with the schtask command as well?
a specified time and date. The Schedule service must be running to use
the AT command.
AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"
\\computername Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the
day (for example, next Thursday). If date is omitted, the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.
If you're an administrator on the network, you can use the "at" command to specify an action on a remote system.
The above are the parameters of the "At" command.
simply specify the computer you want the command to run on using the "\\computername" option.
Hope this helps!
:o)
Bartender_1