Well, here it is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Function IsWorkstationLocked( computer ) Dim wmi : Set wmi = GetObject("winmgmts://" & computer & "/root/cimv2") Dim logonScreenCount : logonScreenCount = wmi.ExecQuery ("SELECT * FROM Win32_Process WHERE Name = 'LogonUI.exe'").Count IsWorkstationLocked = (logonScreenCount > 0) End Function Dim o If IsWorkstationLocked(computer) Then 'Do something Else 'Do something else End If |