Skip to content

Instantly share code, notes, and snippets.

@rafaelfoster
Created April 25, 2017 14:08
Show Gist options
  • Save rafaelfoster/3de9d2e037eb5896639ff461f706d3ac to your computer and use it in GitHub Desktop.
Save rafaelfoster/3de9d2e037eb5896639ff461f706d3ac to your computer and use it in GitHub Desktop.
'Rename computer by seria
'Rename computer by serial # v1.0 November 2009
dim Bios, BiosSerial, objFSO, objTextFile
'Const ForReading = 1, ForWriting = 2, ForAppending = 8
'get serial number
for each Bios in GetObject("winmgmts:").InstancesOf ("win32_bios")
BiosSerial = Bios.SerialNumber
exit for
next
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputers = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment