Skip to content

Instantly share code, notes, and snippets.

@s1carii
Last active May 19, 2022 14:58
Show Gist options
  • Save s1carii/50d46ee0c1eb5240a07e1da68ea2e058 to your computer and use it in GitHub Desktop.
Save s1carii/50d46ee0c1eb5240a07e1da68ea2e058 to your computer and use it in GitHub Desktop.
Dell Rename to Hardware Serial Number
PowerShell -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dp0Rename.ps1""' -Verb RunAs}"
<#
This script is to be deployed to rename our Dell workstations to ES-[SERIAL] in line with our current inventory policies.
#>
$serial = gwmi win32_systemenclosure | select -expand serialnumber # gets the serial from the box itself and sets it as a variable
rename-computer -newname ES-$serial # renames the machine
read-host "Press ENTER to restart..." # Pauses reboot for user input
restart-computer #restarts computer to effect the change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment