Can't figure this one out, but saying that i am pretty
damn new to this cmd prompt game.
I have lots of users and am always asking them the same
question "what is you IP?" this then takes precious
seconds whilst i talk them through Srart, run, CMD,
ipconfig.. which should take no time at all but as we
have lots of users that don't know what a "return" key is
it can sometimes take a while.
What they do know is their username and usually their
domain name. How can i quickly from the command line
discover what machines they are registered as logged on
to? and then preferably resolve what will proabably be
returned as netbios names back to IP's?
Would be a handy little utility.
Any ideas folks? or is the only way to do this to query
WINS server by hand?
Thanks in advance and here's hoping,
Regards,
Tom Holden
Also consider a slightly different approach; Take a look at the
_highly_ configurable BGINFO from sysinternals.com:-
http://www.sysinternals.com/ntw2k/freeware/bginfo.shtml
--
Ritchie,
Undo address for mail
> http://www.sysinternals.com/ntw2k/freeware/bginfo.shtml
Oops, forgot to mention. While your there also look for PsLoggedOn
(part of the PS Tools suite)
Bginfo.exe is a good solution. Another option would be to run a script at
startup that renames the 'My Computer' icon on the desktop. I like to
rename it with the computername and ipaddress, so it appears like this:
____
| |
|____|
HR-001234
10.110.23.221
"Tom Holden" <bl...@dontbother.com> wrote in message
news:06b601c29af7$2540d280$8df82ecf@TK2MSFTNGXA02...
> Hi Folks,
>
> Can't figure this one out, but saying that i am pretty
> damn new to this cmd prompt game.
>
[ ]
Would they know the computername? I think (maybe) nbtstat might do it
with that.
DHCP server on net.? There are cmd-line utils for DHCPS (perhaps).
(Sorry, I can't test any of this right now).
<snip>
> How can i quickly from the command line
> discover what machines they are registered as logged on
> to? and then preferably resolve what will proabably be
> returned as netbios names back to IP's?
>
> Would be a handy little utility.
>
> Any ideas folks? or is the only way to do this to query
> WINS server by hand?
Here is an option for you. You can remark out the MAC address syntax to
speed it up a little.
Down at the bottom is a simpler script that only lists the username and
workstation name, it also sorts by username when done. Eh, if you're
interested it could be modified to stop when it finds the username and then
ping the computername.
All lines should start with either a space or "::", if not then the line has
wrapped.
@echo off
:: Get the Workstation name, User, Mac Address and IP address for
:: every currently powered up NetBIOS-TCP/IP device in the domain
:: Requires the Messenger Service, which is on by default.
:: ccalvert, last updated 08 Aug 2001
::Domain name can be passed as an argument, or use current if none specified
Set Dom=%1& if %1'==' set Dom=%UserDomain%
::Set output file
Set Out=%Dom%_Info.txt
::Create column headers in text file
ECHO Computer User MAC Address IP Address>%Out%
::Modify the "Window" text
TITLE Gathering info about %DOM%. Text file will open when completed.
::Used later to determine if runnning on Windows 2000
(SET CD=)
::get a list of computernames and pass to subroutine
FOR /f "delims=\ " %%b IN ('net view /D:%Dom% ^|find "\\"') DO call :2nd
%%b
::display results and quit
Start %Out% & GOTO:eof
:2nd
::clear variables
FOR %%G IN (WS Usr MAC IP) DO (set %%G=)
::ping each machine once and store the IP Address
FOR /f "tokens=3 delims=: " %%G IN ('
ping -n 1 %1 ^| find " TTL="') DO set IP=%%G
::if the ping did not return then exit this sub
IF "%IP%"=="" goto:eof
::run nbtstat to find the MAC address
FOR /f "tokens=4" %%G IN ('
nbtstat -a %1 ^| find "MAC Address"') DO set MAC=%%G
::run nbtstat again to find the user
FOR /f "delims=<" %%G IN ('
nbtstat -a %1 ^| find "<03>" ^| find /v "%1"') DO set Usr=%%G
::default if no user
IF "%Usr%"=="" (SET Usr=None )
::removes the padding that Windows 2000 adds to NBTstat output
IF DEFINED CD set Usr=%Usr:~-15%
::pad out the machine name
(SET WS=%1 )
::echo all the results for this machine
echo %WS:~0,15% %Usr% %MAC% %IP%
echo %WS:~0,15% %Usr% %MAC% %IP%>>%Out%
@echo off
set CD=
echo. User Computer>"%temp%\%~n0.tmp"
Set Dom=%1
if %1'==' set Dom=%UserDomain%
for /f "delims=\ " %%a in (
'net view /domain:%Dom% ^|find "\\"'
) do call:2nd %%a
sort<"%temp%\%~n0.tmp">"%~dpn0.txt"
start "" "%~dpn0.txt"
del %temp%\%~n0.tmp"
goto:eof
:2nd
Set User=No current user
for /f "delims=<" %%u in (
'nbtstat -a %1^|find "<03>"^|find /i /v "%1"'
) do set User=%%u
if defined CD set User=%User:~-15%
echo %User% %1
echo %User% %1>>"%temp%\%~n0.tmp"
Cheers
Thanks anyway.
Tom Holden
>.
>
Thanks for that mate, that is effing superb. I have got
the whole script to play with now and I'll see what i can
do with it.
I bow to your skill...
This will certainly give me something to get my teeth into.
Regards,
Tom Holden
>.
>
netsh wins server \\winsservername sh na userid 03
Ex:
On WINS Server BOB1 looking for user ID joe...
netsh wins server \\BOB1 sh na joe 03
--
Joe Richards
www.joeware.net
---
"Tom Holden" <bl...@dontbother.com> wrote in message
news:06b601c29af7$2540d280$8df82ecf@TK2MSFTNGXA02...
Thankyou again.
Tom Holden
>.
>
How about this.
You create a perl script that prints the environmental variables of the
machine they are on then it parses any info that you want and puts it in
a file on their desktop or something. use perl2exe to convert it to an
executable so they don't need perl interpreter. Im sure you can do the
same thing w/ a batch file but parsing the info would be easier w/ perl.
now you just copy this to every pc's C: drive and make a short cut to
their all users main menu dir. they click on it and presto! all the
info you need is there.
alternative(probably easier), you can tweak everyones profile to run a
batch script that copies their ENV variables to a file when they logon.
it writes it to C:\MYENV.txt when they have trouble they call you and
you say go to C: and look for this file and open it and read the info to me.
HTH