Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

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,010 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Simple Linear Regression

704 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