Free Power Tools Brochure
Get Mark Minasi's
17-page guide today!



      

advertisement

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

October 16, 1998 03:16 PM

JSI Tip 0771. A quick way to determine the IPAddress where UserName is logged on from.

Rating: (0)
Windows IT Pro
InstantDoc ID #72095


You can type:

NBTSTAT -c

and receive a display similar to:


Node IpAddress: [0.0.0.0] Scope Id: []
            NetBIOS Remote Cache Name Table
    Name            Type            Host Address    Life [sec]
------------------------------------------------------------
GREYSTONE             UNIQUE      192.168.1.30        010
If the user is not listed, type:

net send jennifer hello
NBTSTAT -c


Node IpAddress: [0.0.0.0] Scope Id: []
              NetBIOS Remote Cache Name Table
    Name            Type            Host Address    Life [sec]
------------------------------------------------------------
JENNIFER              UNIQUE      192.168.1.20        001
GREYSTONE             UNIQUE      192.168.1.30        013
If you need to do this in a batch job, call WhatIP UserName. It will return the whatip environment variable with the IP address, or a 0 if the user is not found.

Example:

call whatip Jennifer
if "%whatip%"

"0" goto notfound

WHATIP.BAT contains:

@echo off
set whatip=
if "%1"

"" goto syntax
set userv=%1
set userv=%userv:"=%
:again
nbtstat -c|find /i "%userv%" > %temp%\where.log
for /f "Tokens=1-7* Delims=. " %%i in (%temp%\where.log) do call :parse "%%i" "%%j" "%%k" "%%l" "%%m" "%%n" "%%o"
if "%whatip%"

"" goto donbt
if exist %temp%\where.log del /q %temp%\where.log
set userv=
goto end
:syntax
@echo Syntax: Where UserName
goto end
:parse
if /i not %1

"%userv%" goto donbt
if /i not %2

"" goto end
set whatip=%4%5%6%7
set whatip=%whatip:""=.%
set whatip=%whatip:"=%
goto end
:donbt
if "%whatip%"

"0" goto end
net send "%userv%" Ignore this interruption
set whatip=0
goto again
:end

You could try using NTNAME instead of NET SEND.

ARTICLE TOOLS

Add a Comment

There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

VB Script to enable user account

Do any of you guys have a VB script that could be used to enable a AD user account? We are setting up a "firecall" ID which will stay disabled until i...222-96219

advertisement

GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS

Podcasts

To successfully implement virtual desktops, IT administrators must carefully match user requirements to specific desktop technologies. Listen to this podcast to learn what you need to keep in mind when formulating your approach to desktop virtualization.

Downloads

PacketTrap IT is a comprehensive and affordable network management and application monitoring solution that solves problems associated with bandwidth, network and application performance, and connectivity. Gain insight into your network - try PacketTrapIT free for 21 days!

Web Seminars

Aside from its employees, data is an organization’s most important resource. Join Windows technical specialist and 11-time MVP John Savill to learn the best practices for managing data using features in Windows Server.
View this web seminar on demand!

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.