Solved

display hostname and user's name ?

Posted on 2003-10-28
6
1,097 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

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…
Gain an elementary understanding of Blockchain technology.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 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