• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 994
  • Last Modified:

change username using command line

Does any know how to change the username on a computer using comming line, I am trying to change the Guest username one 150 PC.
0
woodall01
Asked:
woodall01
1 Solution
 
BrandonGalderisiCommented:
There is no "net user rename" command.  but I found this here on EE.

http://www.experts-exchange.com/Programming/Misc/Q_22031500.html

It points to the following VBScript code which appears to do what you desire.
' This code renames a local account.
' ---------------------------------------------------------------
' From the book "Windows Server Cookbook" by Robbie Allen
' ISBN: 0-596-00633-0
' ---------------------------------------------------------------
 
' ------ SCRIPT CONFIGURATION ------
strComputer = "<ServerName>"   ' e.g. srv01
strOldName = "<OldName>"       ' e.g. Guest
strNewName = "<NewName>"       ' e.g. RallencorpGuest
' ------ END CONFIGURATION ---------
set objComp = GetObject("WinNT://" & strComputer)
set objUser = GetObject("WinNT://" & strComputer & "/" & strOldName & ",user")
set objNewUser = objComp.MoveHere(objUser.ADsPath, strNewName)
WScript.Echo "Successfully renamed account"

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now