Solved

VBSCRIPT: Retrieving the computer name of computers that have their NIC disabled or dont have one.

Posted on 2003-12-02
3
3,001 Views
Last Modified: 2010-08-05
Hi guys,
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 =
True")
For Each objAdapter in colAdapters
    Wscript.Echo "Host name: " & objAdapter.DNSHostName
Next

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.
0
Comment
Question by:Simon336697
3 Comments
 
LVL 28

Expert Comment

by:sybe
Comment Utility
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
0
 
LVL 15

Assisted Solution

by:Raisor
Raisor earned 125 total points
Comment Utility
Hi,

It seems you have only a small range of time to catch the desired data if store pcs come in only through dialup.

What I was thinking of was, that you could use "WMI Notification Events" to enable a "Resource Monitoring" ... so you wouldn't need to care if they dialup at nighttime or at daytime ... you'd only have to watch your Log from time to time ... or find another way to get informed ...

Here you'll find all information about "Monitoring Resources by Using WMI Event Notifications":
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/scrguide/sas_wmi_miat.asp


Best regards, Raisor
0
 
LVL 41

Accepted Solution

by:
graye earned 125 total points
Comment Utility
Wait-a-minute...  There's an obvious flaw in this approach.

The WMI script above *USES THE NETWORK* to connect to remote PC.   Uh... think about it.... those PC's are not on the network (because the NIC is disable or don't even have one) are not gonna be visible to the script.

A convoluted way to consider this is... generate a list of known PCs (by some other means... a paper inventory, for example).  Then compare the list that you get from polling the network.  Compare the list to find out who's missing.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

A short article about a problem I had getting the GPS LocationListener working.
A short article about problems I had with the new location API and permissions in Marshmallow
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now