Active Directory/Documentation/Monitoring Lab Usage
Purpose
Have you ever needed to know if anyone is currently working in one of your (Windows-based) teaching labs (i.e. before you initiate a complete lab reboot using the Specops tool)? Or have you ever wanted to know in real-time the names of the individual users who are currently using a public lab in your college? Is so, take advantage of the script provided below!
Implementation
To create the list of computers for the lab you specify the script performs an ADSI query of your .laptops and .desktops groups. The script then individually 'pings' (your lab machines must allow ICMP traffic) each lab computer (to determine if the computer is on), performs a WMI query to determine the logged on user, and lastly connects to the campus LDAP server to look up the users full name.
The script provides options for directing output to either the console or a to a file. You can also specify three different formats for the output: text, csv, and html. The file is generated in the current working directory and is named using a combination of your specified college prefix, department prefix, and lab name.
Note: The script assumes you are using the default WolfTech OU layout for your teaching, public, and research labs, including the .desktop and .laptop groups that contain your computer accounts.
Usage
The defaults for the script include echoing the output to the console, formatting in basic text and assuming you are quering a teaching lab. To specify otherwise use the command line switches. You must specify both 'college' prefix and 'lab' name. Some college OU's follow the department layout (TEX for example) and therefore in those cases the 'department' does not need to be specified. Be sure to use quotes around your lab name if it contains spaces. From a command prompt, run the script below using a WolfTech account that has the authority to remotely connect to your lab computers:
view_lab_usage.vbs [/output:<console(default):file>] [/format:<text(default):csv:html>] /college:<college abbrev> [/department:<college dept>] /lab:"<lab name>" [/type:<teaching(default):public:research>]
Ex. 1 - Display the users for ECE's 'EBII 1020' teaching lab to the console:
view_lab_usage.vbs /college:COE /department:ECE /lab:"EBII 1020"
Ex. 2 - Create an HTML file containing the users of ECE's 'EBII 1020' teaching lab:
view_lab_usage.vbs /college:COE /department:ECE /lab:"EBII 1020" /output:file /format:html Generates File: COE-ECE-EBII 1020.html
Ex. 3 - Display the users of TEX's Fashion Studio teaching lab w/sample output:
view_lab_usage.vbs /college:TEX /lab:"Fashion Studio 1119"
Microsoft (R) Windows Script Host Version 5.7 Copyright (C) Microsoft Corporation. All rights reserved.
--------------- ------------------ ------------------ COMPUTER USERNAME FULLNAME --------------- ------------------ ------------------ TEX-CLAIBORNE WOLFTECH\kbryant Kobe Bryant tex-landsend ** Offline ** ** Offline ** tex-jordache WOLFTECH\ljames Lebron James tex-llbean ** Available ** ** Available ** tex-jcrew WOLFTECH\tmcgrady Tracy McGrady tex-morgan ** Available ** ** Available ** tex-munsingwear WOLFTECH\mjordan Michael Jordan tex-op ** Available ** ** Available ** tex-quicksilver ** Available ** ** Available ** tex-speedo WOLFTECH\labird Larry Bird tex-swatch ** Available ** ** Available ** tex-vans ** Available ** ** Available **
Bugs
- Add code to handle users whose identity is private - LDAP query currently fails, causes script to abort.
Feature Requests
- Webify this script. It would be nice to have a web page that lets appropriately authorized users select a lab within WolfTech, invoke the script, and view the results, all in a nicely formatted web page.