Link to home
Create AccountLog in
Avatar of ChrisKDixon
ChrisKDixon

asked on

SCHTASK to Run a bat file with Admin Rights

Hello, I'm trying to create a batch file that will create a scheduled task that will call a batch file with admin rights and then delete the task scheduled after it intiates.

Example:
schtasks /create /tn "BackupandRestore" /tr "\\PATH\ComputerBackupM.bat"  /sc once /st /ru user /rp Password /EC /Z

I'm able to run it if I include that following switches, but I want to run instantaneously once the user clicks it. So, I do not want to specify a date or a time. Once, I'm able to figure this out then Iwill create a simple batch file that will call this one so that the user does not get the Admin password.

 /sc once st/ 11:06:00 /sd 02/10/2013
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Why create a scheduled task for a run once immediately solution?  It defeats the purpose
Avatar of ChrisKDixon
ChrisKDixon

ASKER

Well, I can run when computer is idle for 5mins or if you know of a way running the batch file on a domain computer with Admin rights if you can point me in the rigt direction? When I search a way to apply Admin rights it's points to create a schtask
ASKER CERTIFIED SOLUTION
Avatar of Tony Barkdull
Tony Barkdull
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
Thanks