/build/static/layout/Breadcrumb_cap_w.png

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?

2 Comments   [ + ] Show comments
  • Does the batch file work if you run it manually from a command prompt?

    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 9 years ago
    • If I run it through the computer I get an access denied error. See, I need the script to run remotely on accounts that don't have domain administrator privileges. - zipperson 9 years ago
  • That worked SMal! Thanks very much for the assistance! - zipperson 9 years ago

Answers (1)

Answer Summary:
Posted by: SMal.tmcc 9 years ago
Red Belt
0
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 9 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 9 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 9 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 9 years ago
      • Target my system? How would the script then run on theirs, like i need it to? - zipperson 9 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 9 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ