Category filter

PowerShell script to rename Windows devices

As an IT administrator, there could be several reasons why you might want to rename your Windows devices. For instance, you might want to assign familiar and identifiable device names that adhere to your organization’s asset naming convention. Hexnode enables administrators to rename Windows devices on multiple devices using custom scripts simultaneously.

Disclaimer:

The Sample Scripts provided below are adapted from third-party Open-Source sites.

Rename Windows devices

When executing the script, pass the device name to be assigned to the device as Arguments. You can also pass the argument using the wildcards supported by Hexnode, which can be very convenient when simultaneously deploying the script to multiple devices in bulk.

For example, provide the argument as %assettag% to change the device name to its asset tag number as provided in the device summary page in the Hexnode portal.

If a wildcard contains a string of words, passing it as an argument will take in the characters until the first space character. To pass the entire string of words associated, the wildcard should be specified as an argument enclosed in double quotes.

For instance, if the value of the wildcard %assettag% is Macbook Air, then passing it as an argument will only take in the first word Macbook. Whereas, enclosing %assettag% in double quotes will capture the entire string Macbook Air.

Notes:

  • Execute the Restart Device and Scan Device actions after running the script. Once these actions are successful, the change in the device name is reflected across the device and the Hexnode portal.
  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository