Last active
May 19, 2022 14:58
-
-
Save s1carii/50d46ee0c1eb5240a07e1da68ea2e058 to your computer and use it in GitHub Desktop.
Dell Rename to Hardware Serial Number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PowerShell -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dp0Rename.ps1""' -Verb RunAs}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
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