Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monitor program usage

Status
Not open for further replies.

michaelcorleone

Technical User
Sep 29, 2012
2
IE
I haven't any VBScript experience so any help would be fantastic.

I would like to monitor the usage of a software program. There will be ten people who have this program on their laptops and i would like to write a script that could log the usage of the program for each user.
I need the script to start when the computer starts. This would need to just sleep until someone started the relevant program and could either send me an email or write to a log.
I would prefer to get everything in a log rather than be plagued by emails. It would just be very useful to see if people are using the program and who specifically is using it most etc.

Thanks
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I really haven't much experience using vbscript so just trying to see first if what i want is possible!

I have some code on how to check for a process but need to adapt this obviously.

DIM strComputer,strProcess

strComputer = "." ' local computer
strProcess = "jmp.exe"

' Check if Program is running on specified computer (. = local computer)
if isProcessRunning(strComputer,strProcess) then
wscript.echo strProcess & " is running on computer '" & strComputer & "'"
else
wscript.echo strProcess & " is NOT running on computer '" & strComputer & "'"
end
 
Start the script as a logon script using GPO. This is how I generally monitor something remote. However, constanst monitoring of remote processes is resourse intensive and creates a lot of network traffic. I would recommend you find an alternative.

Code:
set objFSO = wscript.CreateObect("Scripting.FileSystemObject")
set objLog = objFSO.OpenTextFile("file.log", 2, true, 0)

do while (some comdition)
   'wait until the process starts, checking every 15 seconds.
   do until (isProcessRunning(strComputer, strPcoess)) : wscript.sleep(15000) : loop

   'log while the process is running
   do while (isProcessRunning(strComputer, strPcoess))
      // enter your logging code here
      objLog.WriteLine "something happened"
      wscript.sleep(15000)
   loop
loop

-Geates

"I do not offer answers, only considerations."
- Geates's Disclaimer

 
A minor modification of my code in thread329-1693877 would achieve your goal. Essentially you just need to change the WML query to "SELECT * FROM __InstanceCreationEvent WITHIN 5 WHERE TargetInstance ISA 'Win32_Process'"

Shout if you need further guidance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top