Announcement

Collapse
No announcement yet.

Change Local Admin password using Batch script

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change Local Admin password using Batch script

    Is there a way of including a line on our Log on Script to password protect the Local Administrator's account on all the machines on our network, some of them may already have passwords and some of them may not, but we want them to all have the same password. Thanks in advance.

  • #2
    Code:
    net user Administrator password
    Obviously change "password" to whatever you want the password to be, but note if you do this via a logon scrip tthe local user would have to be an Local Administrator to do this.

    topper
    * Shamelessly mentioning "Don't forget to add reputation!"

    Comment


    • #3
      Thanks very much, I appreciate your help. About the other thing, will this work in your opinion?

      net localgroup administrators %userdomain%\%username% /add
      net user administrator "password"
      net localgroup administrators %userdomain%\%username% /delete

      This may be far fetched but I'm a novice at scripts and in my naivety I'm thinking this will make the user an admin then do the job and then remove the user before logon, I tried it and it didn't work. I haven't tried it as a start up script though.

      Comment


      • #4
        no because the user will have to be an administrator in the first place to add themselves into the administrators group !!

        topper
        * Shamelessly mentioning "Don't forget to add reputation!"

        Comment


        • #5
          sure, point taken. Thanks.

          Comment


          • #6
            It does however seem, from all indications that it is possible to run:

            net user administrator 'password'

            as a startup script. I'll test this out.

            Comment


            • #7
              Hi pdania,

              Have the admin password as blank text is the most dangerous thing. I recommend you to use vbscript with encryption. Google it.

              Hope that helps,

              Regards,
              Teamwork

              Comment


              • #8
                Code:
                On Error Resume Next 
                Set file_object = CreateObject("Scripting.FileSystemObject") 
                Set list = file_object.CreateTextFile("./Rezult.log") 
                domain = "My_domain" '******** 
                Set container_comp = GetObject("WinNT://" & domain) 
                container_comp.Filter = Array("Computer") 
                For Each comp In container_comp 
                comp_in_domain = comp.Name 
                Set container_user = GetObject("WinNT://" & my_domain & "\" & comp_in_domain) 
                container_user.Filter = Array("User") ' Good 
                For Each user In container_user 
                If user.Name="Administrator" Then 
                list.Write comp_in_domain & " ---"& user.Name & vbCrLf 
                user.SetPassword = "PASSWORD" 
                End If 
                Next 
                Set container_user = Nothing 
                Next 
                list.Close 
                WScript.Quit(0) ' Exit
                All that you need in 4-th line to write a NetBIOS-name of your domain, save this file with a name "bla-bla-bla.vbs". Then - double click the mouse.
                After performance in the same directory where " bla-bla-bla.vbs" file Rezult.log will appear there will be a change of PASSWORD of registration records Administrator.

                Comment


                • #9
                  Re: Change Local Admin password using Batch script

                  Hi

                  I have the same issue. However, my boss requirement is to hide the password & the file must be accessible by all user... she doesn't want user to know the local administrator password. I will convert the batch file to exe so that user won't see it. However,

                  As the company has renamed the local administrator acct a myadmin, i need to do the following:-

                  1. Check if user has myadmin acct. If yes, go to 2. else create the myadmin acct
                  2. Check if myadmin belongs to the administrator group
                  3. if yes
                  net user myadmin password

                  however, I cannot find the checking mechnism (dos command) to create the batch file. Can some1 help me
                  on this

                  Comment


                  • #10
                    Re: Change Local Admin password using Batch script

                    Sneokpen,

                    The last entry on this thread was on 30th June 2005. Can you please post a new thread with your question and if it's relevant please post a link to this thread

                    Thanks

                    Michael

                    P.s. Reported to admins
                    Michael Armstrong
                    www.m80arm.co.uk
                    MCITP: EA, MCTS, MCSE 2003, MCSA 2003: Messaging, CCA, VCP 3.5, 4, 5, VCAP5-DCD, VCAP5-DCA, ITIL, MCP, PGP Certified Technician

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

                    Comment


                    • #11
                      Re: Change Local Admin password using Batch script

                      Thread locked due to age. Please start a new thread.
                      Server 2000 MCP
                      Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

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

                      Comment

                      Working...
                      X