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
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
For each objBIOS in colBIOS
StrNewPCName=objBIOS.SerialNumber
Next
Set MyShell= CreateObject ("WSCript.shell")
StrCurrentControlSet = "HKLM\SYSTEM\CurrentControlSet\"
StrTcpipParams = StrCurrentControlSet & "services\Tcpip\Parameters\"
StrComputerName = StrCurrentControlSet & "Control\ComputerName\"
With MyShell
.RegDelete StrTcpipParams & "Hostname"
.RegDelete StrTcpipParams & "NV Hostname"
.RegWrite StrComputerName & "ComputerName\ComputerName", StrNewPCName
.RegWrite StrComputerName & "ActiveComputerName\ComputerName", StrNewPCName
.RegWrite StrTcpipParams & "Hostname", StrNewPCName
.RegWrite StrTcpipParams & "NV Hostname", StrNewPCName
End With