Hi Guys
I am trying to use a script to rename a machine with a prefix and then its serial number, so for example I want it to be XXXX-SERIALNUMBERHERE. The script I am using keeps coughing up loads of errors and I am completely new to this and hoped someone could tell me who to get the script working.
Cheers
Nick
'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")
For Each objComputer in colComputers
err = objComputer."XXXX-"(BiosSerial)
Next
'messagebox
msgbox "Computername changed to " + BiosSerial + "...", yes