Solved

display hostname and user's name ?

Posted on 2003-10-28
6
1,098 Views
Last Modified: 2008-02-26
is there any scripts or application that can list the current users name with their host name ? We have 200 windows PC that use C001,...C200, each time we have hardtime to find out who is running the PC, we need to either go to WINS, nbtstat, Manager .. to check name one by one.

This is a Win 2000 Active Directive Domain.

0
Comment
Question by:joehuang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 2

Expert Comment

by:EschbacherG
ID: 9642464
Hey Joe,

We have a similar script we run at logon time.  It writes the username, hostname, ip address, and antivirus information to a file on our server.

Anyway, the parameters you want are:

%username%
%computername%

In a logon script, you could something like:

@echo   %username%,  %computername%    >>   \\server\share\login.txt
0
 

Author Comment

by:joehuang
ID: 9643697
Esch,

Is there any way to monitor what object the user access to in real time thru script ?
0
 
LVL 2

Accepted Solution

by:
EschbacherG earned 30 total points
ID: 9644063
You can try using the "PSLoggedOn" tool from www.sysinternals.com.   It's part of the PSTools package for WindowsNT/2000

The format of the command would be:

psloggedon \\C001

You could write a batch file to get the list of users by doing the following:



net view >> host_list.txt

for /f "tokens=1" %%a  in (host_list.txt) do (

  psloggedon \\%%a   >>     user_log.txt

)
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:joehuang
ID: 9645025
Esch,

It seems that your are very familiar with scripting. Is there any good book or web site I can study from ?

Thanks,
0
 
LVL 2

Expert Comment

by:EschbacherG
ID: 9657605
Honestly Joe, Experts-exchange is a great site for various scripts.  If you're not premium member, I would use google to search only EE.

Besides that, i've relied on the Help built into Windows, for help with commands like   for-do loops and what not.

If you've got any more questions, i'd be glad to help you out :)
0
 

Author Comment

by:joehuang
ID: 9717557
Esch,

Would you explain the syntax of "tokens=1" %%a ? I check the windows helper, It seems that tokens=1 parse  the first word from the batch file, how about a in "%%a" ?

please advice.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

630 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