Created
April 25, 2017 14:08
-
-
Save rafaelfoster/3de9d2e037eb5896639ff461f706d3ac to your computer and use it in GitHub Desktop.
'Rename computer by seria
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
'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