VBS: Get ID of user Active
wscript.echo "user active = " & getidusract()
function getidusract()
dim objExecObject,strLine,i
For i=1 to 100000
Set objExecObject = WshShell.Exec("%comspec% /c qwinsta.exe " & i)
Do Until objExecObject.StdOut.AtEndOfStream
strLine = objExecObject.StdOut.ReadLine()
If instr(lcase(strLine),lcase("Active")) > 0 _
Or instr(lcase(strLine),lcase("Actif")) > 0 _
Or instr(lcase(strLine),lcase("Actief")) > 0 _
Or instr(lcase(strLine),lcase("Aktiv")) > 0 _
Or instr(lcase(strLine),lcase("Activo")) > 0 _
Or instr(lcase(strLine),lcase("Aktive")) > 0 _
Or instr(lcase(strLine),lcase("???????")) > 0 Then
getidusract= i
exit for
End If
Loop
Next
end function
/image%2F0881799%2F20140610%2Fob_a8c7fe_logo2.jpg)
Commenter cet article