# schtasks: access is denied win 2k3



## hs2008 (May 27, 2011)

Hi
i am new to the forums so thank for help..
i am trying to change password to scheduler task via the command line:
schtasks /change /tn test-1 /ru domain\Administrator /rp password and I get the error access is denied even that I am logged on with Administrator user.

thanks


----------



## DoubleHelix (Dec 10, 2004)

You're logged in with the local admin account or the domain admin account?


----------



## hs2008 (May 27, 2011)

logged in with local admin user.


----------



## DoubleHelix (Dec 10, 2004)

Log in with the domain admin account and run the command.


----------



## hs2008 (May 27, 2011)

Ok I found my problem, I was out sync in one place, here is what I did:
I am working with server 2008(local) and server 2003 (remote)
On the local I run \\remote (domain)\batch.bat parm1 parm2 parm3 (server user pass)
On the remote I had the batch.bat 
========== my code =====
rem @echo off
set server=%1
set user=%2
set pass=%3
net user %user% %pass%
set output=C:\script\output\schtasks-local.txt
del %output%
schtasks /query /s %server% /fo csv /v|find "%SERVER%\%user%" |find /v "Microsoft" >> %output% 
for /f "tokens= 2 delims=," %%a in (%output%) do call :str %%a
goto :End

:str
set str=%1
set taskname=%str:~1,-1%
rem schtasks /run /tn %taskname% /s %server%
schtasks /change /tn %taskname% /ru %server%\%user% /rp %pass%

:End
========== END ======

Thanks for the quick help


----------

