Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: .bat file to change multiple windows user's passwords  (Read 10801 times)

0 Members and 1 Guest are viewing this topic.

FluffyWhale

    Topic Starter


    Greenhorn

    • Experience: Familiar
    • OS: Windows 7
    .bat file to change multiple windows user's passwords
    « on: May 23, 2015, 05:33:40 PM »
    I have a .bat file that can change the password of one windows user account, however for the purpose i need it to be able to change the password of multiple or all user accounts. Here is the current .bat text so please tell me how to change it or write a new one.

    @echo off

    cls
    set /p CP=Would you like to change the password of ANY user account on your pc? (Y/N):
    IF '%CP%' == 'Y' GOTO CP
    IF '%CP%' == 'y' GOTO CP
    IF '%CP%' == 'N' GOTO DCP
    IF '%CP%' == 'n' GOTO DCP

    :CP
    cls
    set /p UN=What User Account Do you want to change the password for? (Type a user Name. For a list of users type UL.):
    IF '%UN%' == 'UL' Goto NETUSER

    cls
    set /p AYS=Are You Sure you Want to Change the password of the account %UN%. (Y/N)
    IF '%AYS%' == 'Y' goto CPY
    IF '%AYS%' == 'y' goto CPY
    IF '%AYS%' == 'N' Goto DCP
    IF '%AYS%' == 'n' Goto DCP

    :CPY
    cls
    Net User %UN% *
    pause
    exit

    :DCP
    cls
    Echo The password will not be changed.
    pause
    exit

    :NETUSER
    Net User
    pause
    Goto :CP

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: .bat file to change multiple windows user's passwords
    « Reply #1 on: May 23, 2015, 06:45:04 PM »
    What you are doing would seem to be a violation of basic rules about privacy and security.  If you are the real administrator of the system, you should already know this. So unless you can explain why you need to do this, it is doubtful any professionals would help you.

    FluffyWhale

      Topic Starter


      Greenhorn

      • Experience: Familiar
      • OS: Windows 7
      Re: .bat file to change multiple windows user's passwords
      « Reply #2 on: May 24, 2015, 01:48:02 PM »
      I am in a club at school called cyberpatriots. In the club we are given virtual images that are messed up and need to be fixed. Every single time we need to do things like change the passwords and turn on the firewall. I want a batch file to do all the simple stuff quickly, so we can have more time to work on the more complicated problems with the image.

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: .bat file to change multiple windows user's passwords
      « Reply #3 on: May 24, 2015, 05:00:43 PM »
      I feel it necessary to "defend" what is being done here in a way. It is being replied to as if it defies security, or is some sort of exploit. It is not. NET USER <username> * allows a password to be changed. It doesn't just allow you to change any password willy-nilly- one must have appropriate privileges. On a school network, for example, the user doing so will require domain administrator privileges. Given the context they have provided, it makes sense that they would have these privileges within the virtual images.

      By the time this command is of any use for defeating security, that security is already defeated- as Raymond Chen would say, "You're already on the other side of the airtight hatchway".

      All that said- I have no idea what the OP is asking for. If you want to deal with multiple accounts, just run the batch file multiple times. (perhaps in a second batch file)
      I was trying to dereference Null Pointers before it was cool.

      DaveLembke



        Sage
      • Thanked: 662
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: .bat file to change multiple windows user's passwords
      « Reply #4 on: May 24, 2015, 05:19:56 PM »
      Quote
      I am in a club at school called cyberpatriots. In the club we are given virtual images that are messed up and need to be fixed

      Anyone know if Microsoft has an exception for edu's to be able to copy and distribute images to students to operate under the same license key by which the image was created/activated?

      Back in 2004 when I was in college we were strictly told to NOT violate Microsoft EULA by running any systems under the same license key as for the college didnt want the "Microsoft Police" there as the professor stated. We also worked with virtual images of systems that the teacher would mess up, but they would be messed up by the teacher accessing your virtual PC 2004 image at your work station and then you had to go in and fix it. Sometimes it was a CD that was passed around the room that the teacher stated for everyone to run a program in the virtual environment that he made and burned to CD which would flip registry key entry values that you wouldnt know what was changed until boot or until you went to perform some operation within the system etc. And you had to go in and fix the problems. Other times he didnt mess with anything, but wanted you to mess with it and then show him that you did it etc.

      FluffyWhale

        Topic Starter


        Greenhorn

        • Experience: Familiar
        • OS: Windows 7
        Re: .bat file to change multiple windows user's passwords
        « Reply #5 on: May 25, 2015, 08:34:22 AM »
        I feel it necessary to "defend" what is being done here in a way. It is being replied to as if it defies security, or is some sort of exploit. It is not. NET USER <username> * allows a password to be changed. It doesn't just allow you to change any password willy-nilly- one must have appropriate privileges. On a school network, for example, the user doing so will require domain administrator privileges. Given the context they have provided, it makes sense that they would have these privileges within the virtual images.

        By the time this command is of any use for defeating security, that security is already defeated- as Raymond Chen would say, "You're already on the other side of the airtight hatchway".

        All that said- I have no idea what the OP is asking for. If you want to deal with multiple accounts, just run the batch file multiple times. (perhaps in a second batch file)



        The thing is i need the passwords changed as fast a possible. To run the batch file multiple times wouldn't be much faster than just going in and changing it the normal way. On the image we are given there are usually 5+ user accounts and each account needs the password to be changed to "Cyberpatriots!" or something like that. To be able to run the batch file once and change all the account passwords, to a specified password, is the thing i want. We are given admin privileges on the images we work on.

        Geek-9pm


          Mastermind
        • Geek After Dark
        • Thanked: 1026
          • Gekk9pm bnlog
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 10
        Re: .bat file to change multiple windows user's passwords
        « Reply #6 on: May 25, 2015, 10:53:24 PM »
        It deems the BAT file you gave is harder Utahn it needs to be.
        Here is what MS says  about NET USER.

        https://support.microsoft.com/en-us/kb/251394

        Or, at the command line type:

        Code: [Select]
        net help user
        .. .and see all the options.

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: .bat file to change multiple windows user's passwords
        « Reply #7 on: May 25, 2015, 11:46:22 PM »
        The thing is i need the passwords changed as fast a possible. To run the batch file multiple times wouldn't be much faster than just going in and changing it the normal way. On the image we are given there are usually 5+ user accounts and each account needs the password to be changed to "Cyberpatriots!" or something like that. To be able to run the batch file once and change all the account passwords, to a specified password, is the thing i want. We are given admin privileges on the images we work on.
        Instead of using set /p tp accept input, you can likely pipe keyboard input directly into the command eg.

        Code: [Select]
        Net user BC_Programming * < newpassword

        I was trying to dereference Null Pointers before it was cool.