Reyesrj
asked on
Need a script (windows 7) to schedule a task
Hi All,
I wrote a script and it works:
schtasks /Create /TN "Shutdown 11pm" /TR C:\Windows\System32\nw-SC\ Nsd.cmd /SC DAILY /ST 23:01 /RU admin /RP rogue
The task gets created but will not run. I'm thinking that the "/RU admin" should read /RU [hostname]/admin. I tried,
/RU %hostname%\admin. The task will not get created.
Thanks in advance
I wrote a script and it works:
schtasks /Create /TN "Shutdown 11pm" /TR C:\Windows\System32\nw-SC\
The task gets created but will not run. I'm thinking that the "/RU admin" should read /RU [hostname]/admin. I tried,
/RU %hostname%\admin. The task will not get created.
Thanks in advance
schtasks /Create /TN "Shutdown 11pm" /TR C:\Windows\System32\nw-SC\ Nsd.cmd /SC DAILY /ST 23:01 /RU admin /RP rogue /RL
you can check the actual user name by just running:
whoami from a command prompt window, then insert that value for the username and try again.
you can check the actual user name by just running:
whoami from a command prompt window, then insert that value for the username and try again.
ASKER
Thanks becraig,
We clone workstations and I would like to create a task to run the script one time after image is completed. Is there a way to create one script that will use the hostname before admin? I'm trying to create one script and not need to make adjustments to it for every workstation.
We clone workstations and I would like to create a task to run the script one time after image is completed. Is there a way to create one script that will use the hostname before admin? I'm trying to create one script and not need to make adjustments to it for every workstation.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks becraig!
Woked perfect!!!
BTW, I used CMD.
Woked perfect!!!
BTW, I used CMD.
Happy to help.
at 23:01 /every: M. T, W, Th, F, Sa, Su C:\Windows\System32\nw-SC\
This will run with admin rights even when logged off.