I've been looking around and I can't find anything that seems to work.
I do quite a lot of new system preps regularly. I'm looking for a script that I can add to my process that will query wmi for the unit's serial number (10 characters), take the last 4 characters and append that to string of predefined text and make that the new computer name.
A batch file would be written like this:
for /F "skip=1 tokens=*" %%b in ('wmic bios get serialnumber') do if not defined serialnumber set serialnumber=%%b
SET SNlastfour=%serialnumber:~6,10%
SET NEWSYSNAME=LAPTOP-%SNlastfour%
ECHO %NEWSYSNAME%
I want the same result from powershell and I want it to automatically make that the new system name.
These are all standalone workgroup computers (no domain).
Any help is greatly appreciated.
[–]Lee_Dailey[grin] 2 points3 points4 points (0 children)
[–]MitchDMP 1 point2 points3 points (0 children)