I would like to be able to rename the administrator account. However every time I try to rename a built in account I get a permission error. My user has local administrator rights and I am logged in as myself. Is it possible to rename built in accounts?
'Initiliase a few useful bits...
Set objWshShell = WScript.CreateObject("WScript.Shell"
Set objFSO = CreateObject("Scripting.FileSystemObject"
'Rename Consultant account and set a few attributes
RenameUser GetLocalComputerName(),"Administrator","SFAdmin","Sfriday renamed Admin"
Msgbox "Admin Account renamed"
'****************************************************************************************
'Functions and Subs below here...
'****************************************************************************************
Sub RenameUser(strDomain,strOldUsername,strNewUsername,strDescription)
Dim objComputer, objUser, objMoveUser
Set objComputer = GetObject("WinNT://" & strDomain)
Set objUser = GetObject("WinNT://" & strDomain & "/" & strOldUsername & ",user"
objUser.FullName = strDescription
objUser.Description = strDescription
objUser.SetInfo
Set objMoveUser = objComputer.MoveHere(objUser.ADsPath, strNewUsername)
Set objComputer = nothing
Set objUser = nothing
Set objMoveUser = nothing
End Sub
'****************************************************************************************
function GetLocalComputerName()
Dim objNet
Set objNet = WScript.CreateObject("WScript.Network"
GetLocalComputerName = objNet.ComputerName
Set objNet = Nothing
end function
'****************************************************************************************
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.