Solved

Current Logged-on Users

Posted on 2006-06-12
3
230 Views
Last Modified: 2010-04-30
I have users, many of whom have GPOs which prevent them from logging concurrent sessions onto AD. I am looking to build a VB/VBscript tool permitting my Service Desk folks the chance to see which users are logged onto which workstations. I have to assume this has been done many times before...how would you suggest I start this project?

Thank you,
John
0
Comment
Question by:johndarby
3 Comments
 

Accepted Solution

by:
dgooderi earned 500 total points
ID: 16908763
I would start writing a wsh script which has the capability of retreiving the username from your own computer. Then make it handle mutiple computers either by reading a text file or reading computer objects directly from AD. Results would be saved to a CSV for later viewing.

I used this code to find the username from the local computer.

'******************************************************************
'***        Find Username                                       ***
'******************************************************************
Function findUserName(strComputer)
   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkConnection", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
   For Each objItem In colItems
'      mid is used to remove any domain information. 10  was used for the length because standard usernames are not that long
      findUserName = Mid(objItem.UserName,7,10)
   Next
End Function

this function does loop through mutiple times but it does the job. It needs some tweeking.

A further addition would be to use the extracted username to get first name and last name from AD.

Hope this helps.

0
 
LVL 1

Author Comment

by:johndarby
ID: 16923393
Thanks Dgooderi!

I am just needing to loop it to look across all workstations (only) in AD.

Thanks,
John
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

919 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

13 Experts available now in Live!

Get 1:1 Help Now