No announcement yet.

Renameuser Utility

  • Filter
  • Time
  • Show
Clear All
new posts

  • Renameuser Utility

    Hey Everyone,

    I have a script that runs automatically when I build a new PC. The problem I run into is that I need to rename the Administrator account and Guest accounts. Being lazy, I don't want to manually change it on every PC, but since I won't know the "name" of the PC, is there a way to have the Renameuser utility work automatically on just the local PC regardless of the name?

    Thanks in advance,


  • #2
    Re: Renameuser Utility

    For the computer name, can you enter %computername% ? This should be always defined.
    Kevin Stanush
    SystemTools Software Inc.


    • #3
      Re: Renameuser Utility

      This VBS code should work. The frirst block uses a computer name of "." to can access to soem local WMI data, including the actual name of the computer, which the later portion of the script requires to renew an account called Admin to NewAdmin.

      strComputer1 = "."

      Set objWMIService = GetObject("winmgmts:\" & strComputer1 & "\root\cimv2")
      Set colItems = objWMIService.ExecQuery("Select * From Win32_ComputerSystem")

      For Each objItem in colItems
      strComputer = objItem.Name

      Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
      Set colAccounts = objWMIService.ExecQuery _
      ("Select * From Win32_UserAccount Where LocalAccount = True And Name = 'Admin'")

      For Each objAccount in colAccounts
      objAccount.Rename "NewAdmin"


      • #4
        Re: Renameuser Utility

        fyi, our next beta should automate this process if you don't want to write a script. We are adding Dynamic WMI Method Execution in the next update, so that you can run pretty much any WMI method on multiple instances or computers.

        To join the beta group, send a blank email to [email protected]
        Kevin Stanush
        SystemTools Software Inc.