Unable to run script as different user
I am trying to run a batch script which requires a domain administrator account, so i am using the Windows Run As: domain/username and then password.
For some reason though, the script will not run. It says that it is Completed Successfully, but nothing is happening on the computer.
The script itself is suppose to change the user's domain password, and then force a restart.
net user user_name password /DOMAIN
shutdown -r -t 00
Any clue what is going on?
For some reason though, the script will not run. It says that it is Completed Successfully, but nothing is happening on the computer.
The script itself is suppose to change the user's domain password, and then force a restart.
net user user_name password /DOMAIN
shutdown -r -t 00
Any clue what is going on?
2 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
Please log in to answer
Posted by:
SMal.tmcc
10 years ago
Why do you not just login as a domain admin and open a command window on your admin station and change the users password that way? Then issue a restart to that users computer from the cmd window using shutdown with the /m option
net user user_name password /DOMAIN
Comments:
-
Changing the password via Active Directory then running a logout script is a workable option. I would of just preferred to do it all in one script if possible. - zipperson 10 years ago
-
How are you running this?
with cmd.exe as the application and net use is a parameter or with net.exe as the application? - SMal.tmcc 10 years ago-
I was just running a batch file through Kace. The Run a program command. Then I realized they have a run batch file option within Kace. So I put the code I posted in there instead. - zipperson 10 years ago
-
another way to run this so it works is to target your system (be logged in as a domain admin). Just make sure you add the /m so you shutdown their machine not yours. - SMal.tmcc 10 years ago
-
Target my system? How would the script then run on theirs, like i need it to? - zipperson 10 years ago
-
It does not need to run on theirs, It just needs to run on an admins machine in the domain of the user you want to change the pw for. The pw change occurs on the DC not the local machine since you are using the /domain switch. So you can run the script on your admin station and the net user command is passed to the DC. The /m switch in the shut down will redirect the command to that machine - SMal.tmcc 10 years ago
Perhaps try adding some echo and pipe commands to hopefully pin down where it is failing.
e.g
echo user_name >>c:\temp\some.log
net user user_name password /DOMAIN >>c:\temp\some.log
echo password change done >>c:\temp\some.log
shutdown -r -t 00 >>c:\temp\some.log
echo shutdown done >>c:\temp\some.log - anonymous_89149 10 years ago