Solved

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

Posted on 2006-07-17
1
237 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

17 Experts available now in Live!

Get 1:1 Help Now