vbscript Extracting Local PC's name


Example

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colSettings = objWMIService.ExecQuery _("Select * from Win32_ComputerSystem")

For Each objComputer in colSettings
wscript.echo objComputer.Name
Next

This code will echo PC's name in which it's executed .