Home All Groups Group Topic Archive Search About

WMI computer in use

Author
17 Feb 2006 7:35 PM
Rio
Hello,

I have been trying to create an ASP page that would display if a
computer within the network is in use.

all I could come up with is to use WMI to check if there is any users
logged in to any machine
script.vbs
--------
strcomputer="."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
IF IsNull(objComputer.UserName) then
WScript.Quit
else
wscript.echo objComputer.UserName
End if
Next
--------
I was able to get this to run from desktop as long as the account has
an admin rights on all machines across network.

if I run it in IE, I get different results depending on how I
manipulate the code
once I got access denied
another times RCP server is unavailable (when I checked it was running
and DCOm is enabled)
since  I was not able to get it to work
I thought of something else but I can't get it to right

my theory is
(executing the script -- main page)
create an ASP page that runs script.vbs on server machine (desktop)
the script inserts data into a database across network
if machine in use insert host,user, usage=busy
if machine is not in use insert host, usage=free

(Then another ASP page)
viewing data --- this pages loads seconds after previous page
(automatically)
then it looks in database if
PC1 usage is busy then it displays busy image/write text saying busy
Else
it displays free image/write text saying free
then if
PC2 usage is busy then it displays busy image/write text saying busy
Else
it displays free image/write text saying free
etc

if anyone has a clue let me know
thanks in advance

AddThis Social Bookmark Button