Solved

Current Logged-on Users

Posted on 2006-06-12
3
229 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

707 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