Rename local admin (VBScript)

This code can be found in Chapter 2 of Windows Server 2003 Security Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This code renames the local administrator account.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
strNewName = "<NewUserName>"  ' e.g. mike
' ------ END CONFIGURATION ---------

set objComputer = GetObject("WinNT://" & strComputer)
set objUser = GetObject("WinNT://" & strComputer & _
                        "/Administrator,user")
set objNewUser = objComputer.MoveHere(objUser.ADsPath,strNewName)
WScript.Echo "Successfully renamed account to: " & strNewName

This code has been viewed 3471 times.

New from the creators of TechTasks.com: StatSheet.com