I found a way to solve my problem.. if someone is interested, i used this code:
Function FindUserLogonType()
Set oShell = CreateObject("Wscript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
sTmpFile = oFS.GetSpecialFolder(2).ShortPath & "\" & oFS.GetTempName
'Run command and redirect stdout and stderr into temp file
oShell.Run "%ComSpec% /c %SystemRoot%\System32\QWINSTA.EXE >" & sTmpFile & " 2>&1", 0, True
On Error Resume Next
'Open the temp file
Set oTF = oFS.OpenTextFile(sTmpFile)
'Parse the file
'The file should look like this
'Current user start with '>'
' SESSIONNAME USERNAME ID STATE TYPE DEVICE
' rdp-tcp#5 administrator 0 Active rdpwd
' rdp-tcp 65536 Listen rdpwd
'>rdp-tcp#4 administrator 2 Active rdpwd
' console 4 Conn wdcon
' Read first line
sLine = oTF.ReadLine
If Err.Number <> 0 Then
' Something is wrong.
Exit Function '-----> return Empty
End If
On Error Goto 0
If Left(Trim(sLine), 26) <> "SESSIONNAME USERNAME" Then
' Something is wrong. Most likely is the content of the first line
Exit Function '-----> return Empty
End If
Do While Not otf.AtEndOfStream
sLine = oTF.ReadLine
If Instr(1, sLine, ">", 1) > 0 Then
Exit Do
End if
Loop
'Close file
oTF.Close
'Delete it
oFS.DeleteFile sTmpFile
If (Mid(sLine,2,7) = "console") Or (Trim(Mid(sline,42,5))=0) Then
'if line starts with console or id = 0
MsgBox "Console"
Else
MsgBox "RDP"
End if
End Function