Results 1 to 4 of 4

Thread: change local admin password and name

  1. #1
    Join Date
    Feb 2006
    Posts
    214

    change local admin password and name

    I want to change the admin name and password because there is someone leaving our Tech group. I want to change the local admin password on all out machines in AD. I am an admin in our OU and have an admin account on all the machines. I have also got all the current computer names. I wans to change the admin password and admin name and be able to log successes and failures. I think that the below will change the local admin password but how can I change the name and log the results?

    On Error Resume Next
    Set DomObj = GetObject("WinNT://Domain/Computer/Administrator,User")
    DomObj.SetPassword "pswd"

    Thanks for any help

  2. #2
    Join Date
    Jan 2006
    Posts
    3,792

    RE: change local admin password and name

    Try to run the below vbs script on all the machines that are within this OU using Group Policy Logon Scripts and see if that helps:

    ' Script Begin
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colAccounts = objWMIService.ExecQuery _
    ("Select * From Win32_UserAccount Where LocalAccount = True And Name =
    'Administrator'")
    For Each objAccount in colAccounts
    objAccount.Rename "NewAdmin"
    Next

    Dim WshShell, oExec
    Password ="P@ssw0rd"
    strCommand = "net user NewAdmin " & Password
    Set WshShell = CreateObject("WScript.Shell")
    Set oExec = WshShell.Exec(strCommand)
    Do While oExec.Status = 0
    WScript.Sleep 100
    Loop
    ' Script End

  3. #3
    Join Date
    Feb 2006
    Posts
    214

    RE: change local admin password and name

    Thanks alot for the script, I will test it asap. But how do I verify that all have ran it, instead of taking a sample of machines and try to log in with the new name and password? Thanks.

  4. #4
    Join Date
    Jun 2006
    Posts
    623
    Check the below script that will change your local Administrators passwords to the one you specify. (Note that you'll need to encrypt this one using Microsoft script encrypter if your users shouldn't be able to read it in clear text.)

    Code:
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    strComputer = "."
    Set objUser = GetObject("WinNT://" & strComputer & "/Administrator,user")
    objUser.SetPassword "NEW.PASSWORD" ' Enter new password between brackets
    objUser.SetInfo
    Some more information here - http://support.microsoft.com/kb/198642

Similar Threads

  1. Replies: 8
    Last Post: 26-03-2010, 09:53 PM
  2. How to change Mac admin password without disk
    By techanita in forum Operating Systems
    Replies: 3
    Last Post: 22-10-2009, 01:34 PM
  3. Change local administrator password on a DC
    By Jahbriel in forum Active Directory
    Replies: 1
    Last Post: 10-08-2009, 06:06 PM
  4. Local Admin Password change script for Domain PC's
    By Dharitree in forum Window 2000 Help
    Replies: 3
    Last Post: 13-10-2008, 09:32 AM
  5. Replies: 3
    Last Post: 22-04-2007, 02:10 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,503,354.56433 seconds with 16 queries