-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,37 @@ | ||
Set objShell = Wscript.CreateObject ("Wscript.shell") | ||
do | ||
dim islocked | ||
|
||
|
||
call checklock | ||
|
||
|
||
|
||
'================================= | ||
'Functions | ||
'================================= | ||
|
||
function checklock | ||
Dim computer : computer = "." | ||
|
||
If WScript.Arguments.Count = 1 Then | ||
computer = WScript.Arguments(0) | ||
End If | ||
|
||
If locked(computer) Then | ||
Wscript.Quit | ||
Else | ||
do | ||
WScript.Sleep(600000) | ||
objShell.Run "python C:\users\%username%\usercheck\check.py" | ||
loop | ||
loop | ||
wscript.sleep 3000 'for debugging - allow time to enter lock screen | ||
End If | ||
end function | ||
|
||
|
||
Function locked(computer) | ||
Dim wmi : Set wmi = GetObject("winmgmts://" & computer & "/root/cimv2") | ||
Dim lockapp_count : lockapp_count = wmi.ExecQuery ("SELECT * FROM Win32_Process WHERE Name = 'lockapp.exe'").Count | ||
Dim explorer_count : explorer_count = wmi.ExecQuery ("SELECT * FROM Win32_Process WHERE Name = 'explorer.exe'").Count | ||
locked = (lockapp_count >= explorer_count) | ||
End Function |