Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Current Logged-on Users

Posted on 2006-06-12
3
Medium Priority
?
237 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
2 Comments
 

Accepted Solution

by:
dgooderi earned 1500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

877 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