List of remote desktop connections

  • Hello All,

    Can any one please help me find a way to get the list of remote desktop connections to a server through TSQL scripts/system tables.

    E.g: the sql server name is "SQLServerXYZ"

    Now i want to find the list of all the people who has an active Remote desktop connection to server "SQLServerXYZ". SQL Server 2000 enterprise edition is installed on the server.

    Note: I want the remote desktop connections not the remote login connections.

    Thanks

    Naresh

  • Hi,

    Use xp_cmdshell to run qwinsta. you will have to format the results.

    More details here:

    http://www.techtalkz.com/blog/tips-n-tricks/how-to-view-disconnect-remote-desktop-sessions-from-commandline.html

    HTH,

    Meir

  • Not using SQL directly:

    The WMI ODBC Adapter is not available in Windows Server 2003. When you upgrade to Windows Server 2003 from Windows 2000 Server, the WMI ODBC Adapter is not removed if already present on a computer. The ODBC Adapter may be unsupported in subsequent versions of Windows.

    http://msdn.microsoft.com/en-us/library/aa392726(VS.85).aspx#odbc%5Fadapter

    Recommend that you write a VBScript that queries the WMI Win32_LogonSession Class http://msdn.microsoft.com/en-us/library/aa394189(VS.85).aspx. The VBScript could include logic to insert into a SQL Server table.

    SQL = Scarcely Qualifies as a Language

  • Thanks for the help guys. I'll update this thread with my findings based the the links provided by you.

  • Hi

    you may also want to post this in the appropriate forum in future

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • You could also use dos query user query user via xp_cmdshell and punt the output into a table and then parse this out to find rdp sessions.

    Andrew

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply