Ying Li at myITforum.com

PowerShell & System Center

VB/WMI script to read remote registry to get IP address information

Here is a VB/WMI script to read remote registry to get IP address information for server.  First, it uses WMI to read a string and to determine which network card to use. Then it will read a multi-string value to get the IP addresses. The IP address is actually stored in an Array, we will need to use Join function to place the elements in a string and then use split function to get the specific Octet we are interested.


On Error Resume Next

strComputer = Inputbox ("Enter The Server Name")

Const HKEY_LOCAL_MACHINE = &H80000002

'Use WMI provider to connect to remote registry
Set oReg=GetObject( _
   "winmgmts:{impersonationLevel=impersonate}!\\" &_
    strComputer & "\root\default:StdRegProv")

'Determine which network card to use
sNICSearch = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\1" ‘the number may vary”
sServiceName = "ServiceName"
oReg.GetStringValue _

'To get the IP address
sInterfaceskey = "System\CurrentControlSet\Services\TCPIP\Parameters\Interfaces\"
sIPAddressKey = sInterfacesKey & strValue
sIPAddress = "IPAddress"

oReg.GetMultiStringValue _

'To manipulate the array(Join & Split) to get the Octets Information
strDelimiter = "."
strIPAddress = Join(arrValues, strDelimiter)

Wscript.Echo strIPAddress

strIPOctets = split (strIPAddress, strDelimiter)
ThirdOctet = strIPOctets (2)

Wscript.Echo ThirdOctet

Posted: Mar 05 2007, 11:32 AM by yli628 | with 10 comment(s)
Filed under:


dthomson said:

I am curious why you would want to go this route since this information is more easily attainable by performing a ping or by using WMI to directly query the network card instances.  This would eleviate the problem introduced when the actual registry entry for the NIC is not known.  FWIW:  There are a number of scripts available in the Code Repository and at the TechNet Script Center that will allow the user to retrieve a multitude of propeties from the NIC.

# March 5, 2007 12:09 PM

yli628 said:


Thanks for your comment and I posted a second script which use wmi(without registry) to get the informaion.

I agree with you, the wmi(without getting to the registry)way is better.

# March 9, 2007 9:48 AM

MaxGXL Benefits of Glutathione » MaxGXL Glutathione said:

\"We made a drug out of a virus by engineering its destructive abilities from a foe into a friend,\" said Matthias Gromeier, M. D., who led the team. \"The rhinovirus acts as the trigger that activates gene expression, but the genes being expressed- the

# March 29, 2008 5:05 AM

dvd clone said:

Don’ t you think the idea is neat, having a coffee mug that can tell you everything you want in the early morning? Such as the weather, time, traffic, stocks etc, without needing you to sit in front of your computer screen while having your breakfast

# April 2, 2008 9:17 PM

dvd copy software said:

Never mind the money…. From what I’ ve heard about Windows Vista’ s intrusive qualities, I don’ t understand why anyone would upgrade to it… I’ ve heard that it’ s built in risk assessments will automatically delete components it deems risky- whether

# April 14, 2008 10:21 PM

dvd burning software said:

For FRACTAL FLESH, as part of Telepolis, he developed a touch- screen interfaced Muscle Stimulation System, enabling remote access, actuation and choreography of the body. Performances such as PING BODY and PARASITE probe notions of telematic scaling

# April 14, 2008 11:11 PM

dvd decrypter said:

Blogging Digital divide E- commerce E- government Elections Education Entertainment File sharing Games Green computing Hardware Gadgets IPR issues IT industry Industry history IT statistics Net neutrality News Open Source Linux PH domain Personal computing

# April 15, 2008 1:02 AM

dvd decrypt said:

Many processes run under the name“ SVCHOST. EXE” and when it has problems, it’ s difficult to track down the cause. Examples of problems include system hangs or 100% CPU utilization that is attributed to the service. The performance team of Microsoft

# April 15, 2008 2:04 AM

shrink dvd said:

From the specs of the N96, this is one phone that I would definitely love to have. It looks like an Iphone, it now has a built- in memory like the N95 8GB and an external memory slot like the classic N95. With all the features it have, I just hope that

# April 17, 2008 4:21 AM

how record dvd said:

“ There are a few things to look at when your computer is running slow. some can be hardware and some can be software, and some can be the person who is sitting at your desk right now. Let’ s go ahead and check a few things. I find it easier to start

# April 19, 2008 3:04 AM