Improve company productivity with a Business Account.Sign Up


Login Name to DNS/IP Resolution on local network app?

Posted on 2002-03-24
Medium Priority
Last Modified: 2010-05-02
I monitor a network (remotely). When I have to do remote access on their PCs, I need either the user's DNS name or IP address - something the user has no idea how to find, and frankly I'm tired of walking them through an IPCONFIG session. Without loading anything on their side, can a VB application be scripted that will allow me to put their login name into a prompt box (they all know their login names, or I have access to look it up) and have it poll our servers to resolve either their machine's DNS name or current IP address? I've seen VBS scripts that come close, and wouldn't be opposed to running one of those either. FYI - my network consists of Windows 95, NT amd 2000 users. I will adjust the points if necessary. Thanks in advance!
Question by:Boomtastic

Expert Comment

ID: 6893036
try lookng at some of the apps here

LVL 17

Expert Comment

ID: 6893046
I have set up an IP address cache on a server. The client with thevariable IP address opens a url on the server. The server returns the public IP of the client.


The site returns the current public IP of the client.  Unless you know the codes to gain acces to the IP cache you will receive a message database down.

So I created also a routine that picks up a chached address:$ip.asp?GetIP=Fred, so in this case it returns Fred's address.  In this way I can get 2 systems with variable public Ip addresses to sync. together at a predeterminted time and automatically connect.

The function $IP.asp uses code a bit like following:

Response.Write Request.ServerVariables("REMOTE_ADDR")

So in your case the users just clicks on a linkto your web-site which returns the ip address.

Hope this helps....

LVL 17

Expert Comment

ID: 6893054
The problem with using Network API is that your system has no way of knowing its public IP address. In a corporate environment the packet may pass through a number translations which would be transparent to the local system.

e.g. You start with address, when your packet reaches the first router it turns your ip address into its public range, then it hits router 2 and turns again, etc.
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.


Author Comment

ID: 6926075
Here's a VB script that polls the server and returns information like I mentioned above. This is similar to what I am looking for, but with it returning the DNS name of the machine that the user is currently loged into.

' Get User Information gui.vbs
' Revision history
' Created 11-26-2001 by Ralph Montgomery - Firsthealth of the Carolinas (

' Initialize the variable farm
Dim objUserName, objUserDomain, oGroup, objUser, gList, WshShell, sMessage, sTitle
Dim objDomain, vDomain, vUserName

Dim objChangePwdTrue, objChangePwd, objUserProfile
Dim objPwdExpiresTrue, objFlags
Dim objAcctDisabled, intPwdExpired, objPwdExpiredTrue

' Set WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")

' Pull Environment variables for domain/user
vdomain = WshShell.ExpandEnvironmentStrings("%USERDOMAIN%")
vUserName = WshShell.ExpandEnvironmentStrings("%USERNAME%")

SysTest ' sub routine to check for Script Version/ADSI installed

GetInfo ' sub routing to get user information

on error resume Next

' Define user then retrieve and store groups in a list
For Each oGroup In objUser.Groups
      If gList = "" Then
            gList = oGroup.Name
            gList = gList & ", " & oGroup.Name
      End If

'check for expired password
intPwdExpired = objUser.Get("PasswordExpired")

      If intPwdExpired = 1 Then
            objPwdExpiredTrue = "Yes"
            Else objPwdExpiredTrue = "No"
      End If
'Check for Must Change Password Flag
objFlags = objUser.Get("UserFlags")

      If (objFlags And &H00040) <> 0 Then
            objChangePwdTrue = "No"
            Else objChangePwdTrue = "Yes"
      End If

' Is password set to NEVER expire?
objPwdExpires = objUser.Get("UserFlags")

      If (objPwdExpires And &H10000) <> 0 Then
            objPwdExpiresTrue = "Yes"
            Else objPwdExpiresTrue = "No"
      End If
' Is the account disabled?
      If objUser.AccountDisabled = True Then
            objAccountDisabled = "Yes"
            Else objAccountDisabled = "No"
      End If
'How many wrong logins?
objBadLogins = objUser.BadLoginCount
' How old is the current password?
oPwdAge = objUser.Get("PasswordAge")
objPwdAge = FormatNumber(((oPwdAge/60)/60)/24, 0)

' Set Profile path to tabs if blank
      If objUserProfile = "" Then
            objUserProfile= "<None>" & vbTab
            Else objUserProfile = objUserProfile
      End If

' Set sMessage box variables to null      
sMessage =""

'popup user information: each line broken up for better reading
sMessage = sMessage & "Domain: " & objDomain & vbTab & "User Name: " & objUserName & _
vbTab & "Full Name: " & objUser.FullName & vbTab & vbTab & "Description: " & _
objUser.Description & vbCrLf & vbCrLf

sMessage = sMessage & "Password Expired: " & objPwdExpiredTrue & vbTab & _
"User can change Pwd: " & objChangePwdTrue &  vbTab & "Account Disabled: " & _
objAccountDisabled & vbTab & vbTab & "Account Locked Out: " & objUser.IsAccountLocked & _
vbTab & "Password Age: " & objPwdAge & vbCrLf & vbCrLf

sMessage = sMessage &  "Bad Logins: " & objBadLogins & vbTab & vbTab & "Last logon: " & _
objUser.LastLogin & vbTab & "Password Never Expires: " & objPwdExpiresTrue & _
vbTab & "Password Minimum Length: " & objUser.PasswordMinimumLength & vbCrLf & vbCrLf

sMessage = sMessage & "User Profile Path: " & objUserProfile & "Home Directory: " & _
objUser.HomeDirectory & vbTab & "Login Script: " & objUser.LoginScript & vbCrLf & vbCrLf

sMessage = sMessage & "User Groups: " & vbCrLf & vbCrLf & gList & vbCrLf

' Display User Information!
WshShell.Popup sMessage,0,"User Information for: " & objUserName & " in " & objDomain

Sub GetInfo()

' Retrieve Domain from user
sMessage = "Please enter the domain to search." & vbCrLf & vbCrLf & _
"Default is: " & vDomain & vbCrLf & vbCrLf
sMessage = sMessage & "Hit Cancel or enter a blank to quit"
sTitle = "Domain to Search"

      'get resource domain name, domain default
      objDomain = InputBox(sMessage, sTitle, vDomain)
      ' Evaluate the user input.
      If objDomain = "" Then    ' Cancelled by the user
      End If
' Set sMessage box variables to null      
ssMessage = ""
ssTitle = ""

on error resume Next

' Define username dialog box variables.
sMessage = "Please enter the USER Login ID" & vbCrLf & vbCrLf & _
"Default is: " & vUserName & vbCrLf & vbCrLf
sMessage = sMessage & "Hit Cancel or enter a blank to quit"
sTitle = "USER Login ID"

      'get resource domain name, domain default via input box
      objUserName = InputBox(sMessage, sTitle, vUserName)
      ' Evaluate the user input.
      If objUserName = "" Then    ' Cancelled by the user
      End If
      ' Display Just a minute!
      sMessage = "This may take a few seconds. . ."
      WshShell.Popup sMessage,2,"One moment please. . . "
      sMessage = ""
'Attempt to bind to the user
Set objUser = GetObject("WinNT://"& objDomain &"/"& objUserName & "",user)

If Err Then
      msgNoUser =  "Error: Could not bind to the following user: " & vbCrLf _
            & vbCrLf & "WinNT://" & objDomain &"/"& objUserName & vbCrLf & vbCrLf _
            & "Please verify your domain and user name and try again"
      WshShell.Popup msgNoUser,0,"Error retrieving information",vbCritical
      msgConnected = "Connected to user WinNT://" & objDomain &"/"& objUserName & vbCrLf
      WshShell.Popup msgConnected,0,"Connected To " & objUserName & " in " & objDomain, vbInformation
End If

End Sub

Sub SysTest()
on error resume Next

' WSH version tested
Major = (ScriptEngineMinorVersion())
Minor = (ScriptEngineMinorVersion())/10
Ver = major + minor
'Need version 5.5
      If err.number or ver = 5.6 then
      message = "You must load Version 5.5 (or later) of Windows Script Host" & vbCrLf &_
        vbCrLf & "Located at: \\servername\share\scr56en.exe"
End If

'Test for ADSI
key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{E92B03AB-B707-11d2-9CBD-0000F87A369E}\version"
key2 = WshShell.RegRead (key)
if Err <> 0 then
        message = message & "ADSI 5.2  must be installed on local workstation to continue" & vbCrLf &_
        vbCrLf & "Located at: \\servername\share\adsi5.2.exe"
      WshShell.Popup message,0,"Workstation Setup Error",vbCritical
End If

'Test whether the host is CScript.exe.
'G. Born code...

If IsBatch = "TRUE" Then
      If (Not IsCScript()) Then
    message = "You must set default host to cscript to run as a batch." &vbcrlf &_
      "Use the command wscript //h:cscript"      'popup closes to avoid desktop hell
      WshShell.Popup message,3,"Workstation Setup Error",vbCritical
    WScript.Quit            ' Terminate script.
      End If
End if
End Sub

Function IsCScript()
    ' Check whether CScript.exe is the host.
    If (InStr(UCase(WScript.FullName), "CSCRIPT") <> 0) Then
        IsCScript = True
        IsCScript = False
    End If
End Function
'**** Script Ends

LVL 49

Expert Comment

ID: 7637805
Hi Boomtastic,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

Boomtastic, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
DanRollins -- EE database cleanup volunteer

Author Comment

ID: 7638026
Actually, the question wasn't forgotten - it was never really answered. But now that I'm laid off, I no longer need this tool, so closing it would be best. Thank you!!

Accepted Solution

SpideyMod earned 0 total points
ID: 7753626
per recommendation

Community Support Moderator @Experts Exchange

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

579 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