Kaseya Community

Script to change a current user...

  • Hi,

    Is there a script that will allow me to change the login name of the current user and put a password to it?

    I have a few computers that use "Owner" as their login name at windows startup and do not have a password. I want to modify it to say "" and assign a random password to it.


    Legacy Forum Name: Script to change a current user...,
    Legacy Posted By Username: mkirtani
  • 1. Save the following file to your KServer as RenameUser.vbs. Change newName to the name you want the user ID to have.

    strComputer = "."

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    Set colAccounts = objWMIService.ExecQuery _
    ("Select * From Win32_UserAccount Where LocalAccount = True And Name = 'Owner'")

    For Each objAccount in colAccounts
    objAccount.Rename "newName"

    2. Write the file to the machine.

    3. Execute Shell Command "cscript \RenameUser.vbs

    4. Execute Shell Command "net user NewName "
    The password can be up to 14 characters.

    5. If desired, then delete the RenameUser.vbs file.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: RCS-Michael