views:

1134

answers:

6

At my workplace, we have lab machines that we use to do our testing.

The standard procedure to reserve a machine for testing was to walk around the office to make sure that no one was using the machine.

This is highly inefficient and time consuming.

At first, I set up a web page where people could reserve the lab machine but nobody was keeping the page updated so that turned up to be useless.

I finally found a solution using Microsoft log parser and wanted to share it to the stack overflow community.

It is a batch file that runs on the machine so the user can identify the last users that use the machine and easily IM them to ask if the machine is free.

Is there a better solution to do this?

+2  A: 

You will need to install the Microsoft Log Parser

Then create the following 2 files

TSLoginsDetails.sql

SELECT 
      timegenerated, 
      EXTRACT_TOKEN(Strings,1,'|') AS Domain, 
      EXTRACT_TOKEN(Strings,0,'|') AS User, 
      EXTRACT_TOKEN(Strings,3,'|') AS SessionName,
      EXTRACT_TOKEN(Strings,4,'|') AS ClientName,
      EXTRACT_TOKEN(Strings,5,'|') AS ClientAddress,
      EventID
FROM Security 
WHERE EventID=682 
ORDER BY timegenerated DESC

TSLogins.bat

echo off
cls
c:
cd "c:\Program Files\Log Parser 2.2\"
logparser.exe file:TSLoginsDetails.sql -o:DATAGRID

Now by placing this batch file on the desktop, the user can see who were the last people to login and contact them by IM to verify if they are done.

Julien Nephtali
Expand it so when you log in, if it isn't the current user who logged in last, set an alert to contact the correct person. (Start IM, prefill email, use some other notification protocol.) If it was the current user, do nothing.
MrChrister
Excellent suggestions.
EBGreen
Doesn't this require that the person running the batch file have already logged in to the machine in question; in other words, possibly already broken into the other user's session?
Ben Dunlap
Why don't you have your users log in to these lab machines with their own user accounts? Then when someone else tries to log in, Windows will just tell you that another session is currently active, and it will tell you who is logged in.
Ben Dunlap
bslorenceWe log in console. We dont have a domain set up in our workplace.Its not considered harmful if you cut-off someone's session just as long as you dont stop a load test someone else started.
Julien Nephtali
I see. Are you running the s/w you develop on these lab machines or are they just test clients for servers running separately? I'm just asking because it sounds like you might also all be logging in with admin privileges to the test machines.
Ben Dunlap
Separate thought, sort of: can you change "FROM Security" in your query to "FROM \\remotemachine\Security" to allow developers to run this from their own machines? Credentials might be a problem if you don't have Active Directory.
Ben Dunlap
... I guess that also wouldn't work if your developers aren't running Windows at their desks. ;-)
Ben Dunlap
A: 

How about posting the information from the log file to the website that tells who is currently using the machine as well.

  1. Check and notify when they log in.
  2. Updated the "who is using the machine" page you made prior.
  3. Run a AT job that checks every couple of hours who is on it.
MrChrister
Good idea, I will look into this.
Julien Nephtali
A: 

I'm not sure if I understand you, but there are a set of command line tools to deal with terminal server sessions, and there's also a Windows API to do the same if you need to do this from a program.

krusty.ar
A: 

Since it sounds like you're a microsoft shop, you can set up the machines as resources in outlook/exchange and reserve them that way.

Joel Coehoorn
I think the issue is more a matter of compliance. The OP already had a scheduling system in place but it was not used.
EBGreen
A: 

Use the built-in command qwinsta (Query Win Station) to figure out what sessions (including console) are active or inactive (disconnected) and then act on the given information (creds to krusty.ar btw for linking this already).

If you feel people are abusing the machine in question, refer to rwinsta to nuke their sessions into oblivion...

Oskar Duveborn
A: 

Totally out of the box:

You can install the Software Testing Automation Framework (STAF) on your servers and desktops to manage your tests. It's written in Java, so you can use it on Windows and Unix/Linux desktops and servers.

Using STAF, you can create a resource pool of test servers on which you conduct tests, then write STAX jobs (STAX is a STAF execution framework) to conduct the tests. The job can grab the first available server from the resource pool, run the test, monitor the test status, log results, notify the submitter, then release the server back into the pool when done. If you have multiple people submitting jobs for tests, STAF will manage the queue of requests and satisfy them as they came in. Users can either monitor the job from their desktop, or you can set up email alerts to notify them when the test is complete.

Patrick Cuff