Solved

display hostname and user's name ?

Posted on 2003-10-28
6
1,092 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
  • 3
  • 3
6 Comments
 
LVL 2

Expert Comment

by:EschbacherG
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:joehuang
Comment Utility
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
Comment Utility
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
Comment Utility
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

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…
In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now