Solved

I need a VB Script snippet that will give me the Machine IP via a logon Script

Posted on 2006-07-17
1
241 Views
Last Modified: 2010-04-18
Hi

I'm looking for a VB Script Snippet to allow me to identify where a machine is located at logon, for example IP Address and act on it accordingly.

I have a domain operating over three WAN links with mobile users, it would be useful to know where they are logging on, to allow auto modification of shares to point to local shares to reduce WAN Traffic.

Any assistance would be much appreciated

Barry
0
Comment
Question by:BarryCoe
1 Comment
 
LVL 3

Accepted Solution

by:
SMFX earned 125 total points
ID: 17121333
WMI Tasks:  Networking
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_tasks__networking.asp

"How do I..."  "...determine the IP address of a computer?"
<quote>
Use the Win32_NetworkAdapterConfiguration class and check the value of the IPAddress property. This is returned as an array, so use a For-Each loop to get the value.
strComputer = "."
Set objWMIService = GetObject( _
    "winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
    ("Select IPAddress from Win32_NetworkAdapterConfiguration ")
 
For Each IPConfig in IPConfigSet
    If Not IsNull(IPConfig.IPAddress) Then
        For i=LBound(IPConfig.IPAddress) _
            to UBound(IPConfig.IPAddress)
                WScript.Echo IPConfig.IPAddress(i)
        Next
    End If
Next
</quote>

-SMFX
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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