Announcement

Collapse
No announcement yet.

change admin password for local comp using batch

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • change admin password for local comp using batch

    hi
    I am a new admin. One of the task I have to do is change admin password using batch. It is pretty much a test to sort of prove myself. I wrote a very simple one, which works but only with users that have "admin" rights. But for regualr restricted user accounts, it doesn't. This is what i got

    echo off
    net user administrator password

    Can anyone plz help me to get this to work through batch. So when a user logs on batch changes the password for local admin. I saw some other post, but they are mostly doing it through vbscript or active directory but i need it to work with batch.

    thanks in advance

  • #2
    Re: change admin password for local comp using batch

    If you're resticted to using a batch file, there's no way to store and then send the password to "net user" like you can with VBscript.

    In this case, I suggest using pspasswd. It's part of the Sysinternals PsTools suite.

    http://download.sysinternals.com/Files/PsTools.zip

    Copy pspasswd to the same folder where the batch file will exist.

    Code:
    pspasswd /accepteula
    pspasswd \\%computername% -u domain\adminuser -p adminpass administrator newpassword
    As with VBScript, the passwords will be stored as clear text in the .bat or .vbs file, so anyone with brains can open them to get the passwords. So... Run the script for a few days and then remove it once it's done the job. Leaving it there is a bad idea.
    Last edited by ahinson; 9th April 2007, 15:49.
    Andrew

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Re: change admin password for local comp using batch

      ahison thanks for replying back.
      I don't actually need to save the pass.... its the admin for local computer. We change the local admin password every month. So all i would need is for that batch file to run once in a month it will change the password to watever i want it to.

      i used the commands

      net user administrator password (only works on computers with admin rights for users)

      it changes the password but the thing is the users don't have privilage to change password, so when they login (that is when the above mentioned script runs) all the commands are correct but security restrictions prevents it from working. Is there a way where the admin password would change after restart... using pretty much the same batch script?

      Comment


      • #4
        Re: change admin password for local comp using batch

        Originally posted by hshaik
        We change the local admin password every month. So all i would need is for that batch file to run once in a month it will change the password to watever i want it to.

        i used the commands
        net user administrator password (only works on computers with admin rights for users)

        it changes the password but the thing is the users don't have privilage to change password, so when they login (that is when the above mentioned script runs) all the commands are correct but security restrictions prevents it from working. Is there a way where the admin password would change after restart... using pretty much the same batch script?
        Run the batch as a computer startup script, not as user logonscript
        Check these links how you can leave the local Administrator password, for security reasons, out of your bach-file;
        - http://forums.petri.com/showthread.php?t=14180
        - http://forums.petri.com/showthread.php?t=13750



        \Rem

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment

        Working...
        X