VBSCRIPT: Retrieving the computer name of computers that have their NIC disabled or dont have one.
Posted on 2003-12-02
I would like to retrieve the computer name on a whole lot of pcs. The
problem is I cannot use a networking object to retrieve it because some of
the pcs have their network card disabled or dont have one at all. I work in retail as a pos support
guy, and we get info from the stores pcs through dialup.
Is there any way to get the host name or computer name of these machines
without doing a query to a network adapter?
Any help greatly appreciated.
I have tried the following:
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled =
For Each objAdapter in colAdapters
Wscript.Echo "Host name: " & objAdapter.DNSHostName
This works for a pc which has their network adapter card enabled, but even
if I change it to FALSE, for disabled card, it does not return it.