Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-12-02
3
Medium Priority
?
3,012 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
ID: 9857159
Set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
0
 
LVL 15

Assisted Solution

by:Ralf Klatt
Ralf Klatt earned 375 total points
ID: 9857766
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 375 total points
ID: 9863383
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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 …

927 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