How to rename your computer using it’s service tag number
Below is a short script that is handy in renaming your computer using the service tag or serial number of the machine. To invoke this on multiple machines you may want to look into running psexec to copy the script locally to the machine, then run and finally reboot the machine.
setlocal
wmic bios get serialnumber | find /I /V “SerialNumber” > “%temp%\sn.txt”
set /p comp_name=<“%temp%\sn.txt”
wmic computersystem where name=”%computername%” rename name=%comp_name%
del “%temp%\sn.txt”
endlocal
Greetings
I would like to rename more than 20 computers using your script above.
Can you assist on how my text file context should be.
For instance i would like to capture all computer service tags and computer names on one text file for renaming.
example J23RW3, Computer 1
P24RW3, Computer 2
You can do this using psexec. I updated the post explaining how to do this. Here’s a link on a psexec tutorial that’s pretty in depth. Let me know if that helps.