1
votes

I need to find out if the current user is a RDP Session, that is simple but I need to know if the session is initiated with the '/admin' flag. In the past I use the Session Id, that was 0 but now on newer Windows Versions its not 0 anymore.

1

1 Answers

0
votes

Perhaps, this is what you need:

[DllImport("Kernel32.dll", SetLastError = true)]
[return:MarshalAs(UnmanagedType.U4)]
public static extern int WTSGetActiveConsoleSessionId ( );