A teensy .vbs script that tells you if someone is logged in, or if the computer is just sitting there at the log in screen so you know when the PC is free and you can sneak in, make your changes/upgrades/maintenance and get out all quiet like.
Who (would this be useful to) ?
Another system admin one mostly. But also anyone who doesn’t play well with others, shouldn’t talk to customers (if you want your customers to be happy), or you’ve just had enough of chasing a customer for the last month and are tired of the “I’m on a deadline, now is not the time to do it”.How?
Because sometimes, phone ping pong, hide and seek, talking to the customer means 2 hours of wild speculations that there was a second java install on the grassy knoll then tell you what they think the best solution is. So you REALLY don’t want to talk to them.
All that aside, they didn’t call up so they could get a bunch of voice messages and email, wait for 3 days and then complain it wasn’t fixed. They called up wanting to say “My thingy thing is broken and I need it fixed” then magically come back from lunch and it’s working with a nice email from the IT pixie. So why don’t we do that?
Set wmi = GetObject("winmgmts://" & computer & "/root/cimv2")
logonScreenCount = wmi.ExecQuery _ ("SELECT * FROM Win32_Process WHERE Name = 'LogonUI.exe'").Count interactiveUserCount = wmi.ExecQuery _ ("SELECT * FROM Win32_LogonSession WHERE LogonType = 2").Count
If logonScreenCount = 1 Then WScript.Echo "Logon screen is being displayed" End If
As always, if you have a better idea or solution leave it in the comments and help some other poor soul who wanders here.