ºÚÁϺ£½Ç91Èë¿Ú

Change Windows Username

In order for the ºÚÁϺ£½Ç91Èë¿Ú Agent to perform an account takeover, the ºÚÁϺ£½Ç91Èë¿Ú username must match the local account username on a device.

Prerequisites:

Considerations:

  • Windows will not rename the home directory, but security permissions will be updated to the new username.
  • Any applications that may have depended on the old username may not be updated by the User Account wizard. Be sure to test any applications before making production changes.
  • See Microsoft's .

Changing Username in Windows

To change a username in Windows:

  1. Log into the system using an administrator account that is not the account being renamed. From a command line or PowerShell, run the User Accounts Management wizard:

PS C:\Users\Administrator> netplwiz

  1. Select the user, then click Properties.
  1. Change the User name value to match the Username in the ºÚÁϺ£½Ç91Èë¿Ú directory. 
  2. Click OK and restart the system. 

Changing Username with Commands

You can also use ºÚÁϺ£½Ç91Èë¿Ú Commands to change the name of a local account on a device.

Important:
  • This is a sample command and it's recommend you test it first on a demo device before deploying to a production device.
  • Ensure to replace the values in the sample command with your existing device username $oldName and new username $newName values.

To change a username with ºÚÁϺ£½Ç91Èë¿Ú Commands:

  1. Create a new command in the ºÚÁϺ£½Ç91Èë¿Ú Admin Portal. See Creating a Command Manually to learn more.
  2. Configure the command with the following settings:
    1. For Type, select Windows. Select Windows PowerShell.
    2. Enter the following in the Command field:

# Define the old and new account names
$oldName = "Test_Account"
$newName = "Test Account"

# Check if the script is running with administrative privileges
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
# Relaunch the script with elevated privileges
$newProcess = Start-Process powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs -PassThru
# Wait for the elevated process to complete
$newProcess.WaitForExit()
exit
}

# Rename the local user account silently
Rename-LocalUser -Name $oldName -NewName $newName

  1. Go to the Devices tab and select the device that you need to rename the user account.
  2. Save the command and run it manually.
  3. After the command runs, go to the Results tab. A successful command result displays Success.
Back to Top

Still Have Questions?

If you cannot find an answer to your question in our FAQ, you can always contact us.

Submit a Case