I’m trying to make a script to rename PC’s to their serial number. I’m not great with VB, but I’ve been able to put together enough code to READ the serial number, but I’m not sure where to WRITE it.
Here’s what I currently have:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
For each objBIOS in colBIOS
WScript.Echo "SERIAL=" & objBIOS.SerialNumber
Next
Thanks in advance for any help!
You can change the computer name editing the Windows registry. use this code with extreme caution.
This code is for educational purposes only, I recommend that you use the SetComputerNameEx function and not a script to do these tasks