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

Author Topic: Authentication problem net user/psexec  (Read 13994 times)

0 Members and 1 Guest are viewing this topic.

Arotin

    Topic Starter


    Rookie

    • Experience: Beginner
    • OS: Windows 7
    Authentication problem net user/psexec
    « on: January 29, 2016, 03:29:51 PM »
    Hello,

    im having an issue with my batch script im not sure what im doing wrong..  when i run it i get the error from psexec saying : unknown username or bad password


    for /f %%F in (C:\pclist.txt) do (
    pstools\psexec.exe \\%%F -u Admin -p Pass net user Admin NewPass
    )
    pause


    its weird because if i do not include the "-p Pass" then it will ofcourse ask me for a password.. i put the password in and it SOMETIMES works. lol

    basically im trying to change the local admin account password of all the computers on my work network.. some are on domain some are not. this technically SHOULD work...


    Please Advise,

    Thank you,
    Arotin


    Arotin

      Topic Starter


      Rookie

      • Experience: Beginner
      • OS: Windows 7
      Re: Authentication problem net user/psexec
      « Reply #1 on: January 29, 2016, 03:57:05 PM »
      before anyone says if im putting in the correct password... yes i promise, i triple checked (:

      Squashman



        Specialist
      • Thanked: 134
      • Experience: Experienced
      • OS: Other
      Re: Authentication problem net user/psexec
      « Reply #2 on: January 29, 2016, 04:36:16 PM »
      Well then I will ask the next most obvious question. Why are you not using PSPASSWD?

      Arotin

        Topic Starter


        Rookie

        • Experience: Beginner
        • OS: Windows 7
        Re: Authentication problem net user/psexec
        « Reply #3 on: January 29, 2016, 04:59:12 PM »
        Well then I will ask the next most obvious question. Why are you not using PSPASSWD?

        Every single time i have tried pspasswd, nothing happens. it just gives me the syntax..

        example of my code for pspasswd

        Code: [Select]
        for /f %%F in (PCLIST.txt) do (
        pspasswd.exe \\%%F -u administrator -p Password administrator NewPassword
        )


        So using the psexec in combination with net user actually gets me a step further..


        thanks

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Re: Authentication problem net user/psexec
        « Reply #4 on: January 29, 2016, 11:04:02 PM »
        Every single time i have tried pspasswd, nothing happens. it just gives me the syntax..

        Code: [Select]
        for /f %%F in (PCLIST.txt) do (
        pspasswd.exe \\%%F -u administrator -p Password administrator NewPassword
        )

        Put an echo statement before pspasswd.exe and pause on the next line, and you will see the command being used.  There will be an error in it.

        Squashman



          Specialist
        • Thanked: 134
        • Experience: Experienced
        • OS: Other
        Re: Authentication problem net user/psexec
        « Reply #5 on: January 29, 2016, 11:29:08 PM »
        Every single time i have tried pspasswd, nothing happens. it just gives me the syntax..

        example of my code for pspasswd

        Code: [Select]
        for /f %%F in (PCLIST.txt) do (
        pspasswd.exe \\%%F -u administrator -p Password administrator NewPassword
        )


        So using the psexec in combination with net user actually gets me a step further..


        thanks
        Why are you using the FOR command to get the computer name when PSPASSWD and PSEXEC for that matter have an option to specify a file that has a list of computer names?

        Arotin

          Topic Starter


          Rookie

          • Experience: Beginner
          • OS: Windows 7
          Re: Authentication problem net user/psexec
          « Reply #6 on: February 01, 2016, 10:02:03 AM »
          Why are you using the FOR command to get the computer name when PSPASSWD and PSEXEC for that matter have an option to specify a file that has a list of computer names?

          what? im using the FOR command to go thro a list of ip addresses in that "PCLIST" and do them 1 by 1, and why does it matter? that has nothing to do with my question???

          Arotin

            Topic Starter


            Rookie

            • Experience: Beginner
            • OS: Windows 7
            Re: Authentication problem net user/psexec
            « Reply #7 on: February 01, 2016, 10:11:11 AM »
            Put an echo statement before pspasswd.exe and pause on the next line, and you will see the command being used.  There will be an error in it.


            Tried that, same thing. no errors.. just the syntax.

            Squashman



              Specialist
            • Thanked: 134
            • Experience: Experienced
            • OS: Other
            Re: Authentication problem net user/psexec
            « Reply #8 on: February 01, 2016, 12:07:44 PM »
            what? im using the FOR command to go thro a list of ip addresses in that "PCLIST" and do them 1 by 1, and why does it matter? that has nothing to do with my question???
            Well I guess I am just trying to explain to you how to do it with LESS code or maybe a different way to do it that might work.  The code will execute much quicker if you use the @file option.  But I guess it is a mute point if you can't get any of them to run.

            Arotin

              Topic Starter


              Rookie

              • Experience: Beginner
              • OS: Windows 7
              Re: Authentication problem net user/psexec
              « Reply #9 on: February 01, 2016, 12:10:15 PM »
              Well I guess I am just trying to explain to you how to do it with LESS code or maybe a different way to do it that might work.  The code will execute much quicker if you use the @file option.  But I guess it is a mute point if you can't get any of them to run.


              Okay i will try that way and report back to this post. thank you.

              Squashman



                Specialist
              • Thanked: 134
              • Experience: Experienced
              • OS: Other
              Re: Authentication problem net user/psexec
              « Reply #10 on: February 01, 2016, 12:38:55 PM »
              If you still cannot get the commands to run successfully, I suggest you post a message on the Sysinternal Forum.
              http://forum.sysinternals.com/sysinternals-utilities_forums_cat2.html

              Just a quick question. What operating system are the remote computers?
              You do realize there are prerequisites for the remote computer for any of the PSTOOLS to work.

              Arotin

                Topic Starter


                Rookie

                • Experience: Beginner
                • OS: Windows 7
                Re: Authentication problem net user/psexec
                « Reply #11 on: February 01, 2016, 12:52:02 PM »
                If you still cannot get the commands to run successfully, I suggest you post a message on the Sysinternal Forum.
                http://forum.sysinternals.com/sysinternals-utilities_forums_cat2.html

                Just a quick question. What operating system are the remote computers?
                You do realize there are prerequisites for the remote computer for any of the PSTOOLS to work.


                They are all windows 7, some 32 and most 64. but its gives problems on both. all firewalls are turned off, and all of them are win7 pro and have their built in administrator account enabled (which is the account i want to change the passwords for)

                I tested with the @file option and same thing.


                thanks

                foxidrive



                  Specialist
                • Thanked: 268
                • Experience: Experienced
                • OS: Windows 8
                Re: Authentication problem net user/psexec
                « Reply #12 on: February 02, 2016, 12:43:02 AM »
                Tried that, same thing. no errors.. just the syntax.

                You won't get the syntax if you do what I outlined.

                Code: [Select]
                for /f %%F in (PCLIST.txt) do (
                echo pspasswd.exe \\%%F -u administrator -p Password administrator NewPassword
                pause
                )
                « Last Edit: February 02, 2016, 12:58:28 AM by foxidrive »

                Arotin

                  Topic Starter


                  Rookie

                  • Experience: Beginner
                  • OS: Windows 7
                  Re: Authentication problem net user/psexec
                  « Reply #13 on: February 03, 2016, 05:27:51 PM »
                  You won't get the syntax if you do what I outlined.

                  Code: [Select]
                  for /f %%F in (PCLIST.txt) do (
                  echo pspasswd.exe \\%%F -u administrator -p Password administrator NewPassword
                  pause
                  )


                  All that did was echo the command onto the command line, i copy pasted the code you provided and change the passwords to the proper ones.

                  Arotin

                    Topic Starter


                    Rookie

                    • Experience: Beginner
                    • OS: Windows 7
                    Re: Authentication problem net user/psexec
                    « Reply #14 on: February 03, 2016, 06:37:07 PM »
                    I tried taking out the -u and -p switches, and running it as administrator , and that seemed to work. is there a reason why i cannot provide alternate credentials ?

                    PS the user and password i was providing is the same as the local admin im running the script from. so im very confused as to why its doing that.



                    thanks

                    Geek-9pm


                      Mastermind
                    • Geek After Dark
                    • Thanked: 1026
                      • Gekk9pm bnlog
                    • Certifications: List
                    • Computer: Specs
                    • Experience: Expert
                    • OS: Windows 10
                    Re: Authentication problem net user/psexec
                    « Reply #15 on: February 03, 2016, 08:21:09 PM »
                    Question.
                    Is the pspasswd.exe part of a third party tool kit?
                    Or is it an optional tool from Microsoft?
                    Curious minds need to know.  :)

                    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: Authentication problem net user/psexec
                    « Reply #16 on: February 03, 2016, 11:29:20 PM »
                    It's a sysinternals tool, and as Microsoft bought Sysinternals some time ago, I guess it would count as the latter.
                    I was trying to dereference Null Pointers before it was cool.

                    foxidrive



                      Specialist
                    • Thanked: 268
                    • Experience: Experienced
                    • OS: Windows 8
                    Re: Authentication problem net user/psexec
                    « Reply #17 on: February 03, 2016, 11:40:14 PM »
                    All that did was echo the command onto the command line

                    That's precisely the point of it.

                    pspassword was printing the message because there was an error in the command line, and we can't see the command line or the message that was printed to the console - so you have to figure it out by examining everything.

                    If it's a permissions issue:  then if you right click the code you had originally and select run as administrator then it should work as it is.  This is another debugging step.

                    Arotin

                      Topic Starter


                      Rookie

                      • Experience: Beginner
                      • OS: Windows 7
                      Re: Authentication problem net user/psexec
                      « Reply #18 on: February 04, 2016, 10:28:44 AM »
                      That's precisely the point of it.

                      pspassword was printing the message because there was an error in the command line, and we can't see the command line or the message that was printed to the console - so you have to figure it out by examining everything.

                      If it's a permissions issue:  then if you right click the code you had originally and select run as administrator then it should work as it is.  This is another debugging step.

                      Alright thanks, ill try each step and see where its faulty.

                      thank you sir,

                      foxidrive



                        Specialist
                      • Thanked: 268
                      • Experience: Experienced
                      • OS: Windows 8
                      Re: Authentication problem net user/psexec
                      « Reply #19 on: February 04, 2016, 11:25:27 AM »
                      Oops.  [deleted]

                      :)

                      Arotin

                        Topic Starter


                        Rookie

                        • Experience: Beginner
                        • OS: Windows 7
                        Re: Authentication problem net user/psexec
                        « Reply #20 on: February 04, 2016, 12:08:01 PM »
                        So here is what i got so far,

                        I have tried taking out the -u and -p switches, and just running it on a administrator profile(which i was originally). i am testing on two machines; one is joined to domain and one is not.

                        the one that is not, it changes the password and i can use that password to log into the local admin just fine.
                        the one that is joined to domain the script will change the password and exit with error code 0, BUT when i try to login with the new password it doesnt work and the old one doesnt work either..

                        does that make sense? lol

                        Code: [Select]
                        @echo off

                        setlocal enabledelayedexpansion

                        for /f %%F in (C:\PCLIST.txt) do (
                        pstools\psexec.exe \\%%F net user Administrator NewPassword123!
                        if !errorlevel! NEQ 0 echo %%F >> Failed.log
                        )
                        echo complete
                        pause


                        any ideas? thanks.

                        PS. no im not using pspasswd its the worst creation since trump k thx.

                        patio

                        • Moderator


                        • Genius
                        • Maud' Dib
                        • Thanked: 1769
                          • Yes
                        • Experience: Beginner
                        • OS: Windows 7
                        Re: Authentication problem net user/psexec
                        « Reply #21 on: February 04, 2016, 12:13:30 PM »
                        Then you don't have elevated privelidges for the domain...just the ones who aren't.

                        And i don't even do batch...so i'll leave it to the experts we have.
                        " Anyone who goes to a psychiatrist should have his head examined. "

                        Arotin

                          Topic Starter


                          Rookie

                          • Experience: Beginner
                          • OS: Windows 7
                          Re: Authentication problem net user/psexec
                          « Reply #22 on: February 04, 2016, 12:19:34 PM »
                          Then you don't have elevated privelidges for the domain...just the ones who aren't.

                          And i don't even do batch...so i'll leave it to the experts we have.

                          im running the bat as local admin account to change the local admin password. im not sure what you mean by that; so if i run the batch script as domain admin then it will use the domain admin credentials to connect to the machine but will it change the domain password? i dont want that...

                          patio

                          • Moderator


                          • Genius
                          • Maud' Dib
                          • Thanked: 1769
                            • Yes
                          • Experience: Beginner
                          • OS: Windows 7
                          Re: Authentication problem net user/psexec
                          « Reply #23 on: February 04, 2016, 12:57:06 PM »
                          I'm simply stating you may need domain credentials to make any changes to PC's in the domain...simple as that.

                          As i said i'm no batch expert i'll leave that to others...so i can't speak to what level changes your bat would make.
                          " Anyone who goes to a psychiatrist should have his head examined. "

                          Squashman



                            Specialist
                          • Thanked: 134
                          • Experience: Experienced
                          • OS: Other
                          Re: Authentication problem net user/psexec
                          « Reply #24 on: February 04, 2016, 01:50:30 PM »
                          I'm simply stating you may need domain credentials to make any changes to PC's in the domain...simple as that.
                          I would tend to agree with that.

                          Squashman



                            Specialist
                          • Thanked: 134
                          • Experience: Experienced
                          • OS: Other
                          Re: Authentication problem net user/psexec
                          « Reply #25 on: February 04, 2016, 01:52:33 PM »
                          Code: [Select]
                          @echo off

                          setlocal enabledelayedexpansion

                          for /f %%F in (C:\PCLIST.txt) do (
                          pstools\psexec.exe \\%%F net user Administrator NewPassword123!
                          if !errorlevel! NEQ 0 echo %%F >> Failed.log
                          )
                          echo complete
                          pause
                          Did you really try to use an exclamation in the password with delayed expansion enabled?

                          Pretty sure you could have just kept delayed expansion off and did this instead.

                          Code: [Select]
                          if errorlevel 1 echo %%F >> Failed.log

                          Arotin

                            Topic Starter


                            Rookie

                            • Experience: Beginner
                            • OS: Windows 7
                            Re: Authentication problem net user/psexec
                            « Reply #26 on: February 04, 2016, 02:01:38 PM »
                            Did you really try to use an exclamation in the password with delayed expansion enabled?

                            Pretty sure you could have just kept delayed expansion off and did this instead.

                            Code: [Select]
                            if errorlevel 1 echo %%F >> Failed.log

                            okay so should i take off delayed expansion and try running the batch with domian admin credentials? but as long as i do not specify the domain in the script then it wont modify the domain account correct? i only want to change the local admin password.

                            and as far as the errorcode, why is mine incorrect lol. there could be more error codes besides "1" .



                            patio

                            • Moderator


                            • Genius
                            • Maud' Dib
                            • Thanked: 1769
                              • Yes
                            • Experience: Beginner
                            • OS: Windows 7
                            Re: Authentication problem net user/psexec
                            « Reply #27 on: February 04, 2016, 02:07:17 PM »
                            Quote
                            okay so should i take off delayed expansion and try running the batch with domian admin credentials? but as long as i do not specify the domain in the script then it wont modify the domain account correct? i only want to change the local admin password.

                            This is why you need to have a test PC...select 1 in the domain to test the code...but i'd fix the glitches 1st...
                            " Anyone who goes to a psychiatrist should have his head examined. "

                            Arotin

                              Topic Starter


                              Rookie

                              • Experience: Beginner
                              • OS: Windows 7
                              Re: Authentication problem net user/psexec
                              « Reply #28 on: February 04, 2016, 02:58:04 PM »
                              This is why you need to have a test PC...select 1 in the domain to test the code...but i'd fix the glitches 1st...

                               i have 3 test PCs. 2 are the ones receiving and one is for running the bat file, yeah im going to make some changes and report back with results.


                              thanks.