locked
Determine where the console is being shown RRS feed

  • Question

  • Is there any way to determine on which computer a particular instance of the console is being shown on? I want an add-in to be aware of which computer the administrator is connecting from.
    Thursday, July 19, 2007 11:12 PM

Answers

  • You might be able to retrieve the information you're looking for using the Terminal Services API.
    Friday, July 20, 2007 12:26 AM
    Moderator
  •  

    This is completely untested, and from a cursory glance at the Terminal Services API -

    1. Get the handle to Home Server Console process on the server
    2. Use GetProcessId() to get id of the process
      --> if you're doint this in an add-in then GetCurrentProcessId() will shorten the above to one step
    3. Use ProcessIdToSessionId() to get the id of the session the process is running on
    4. choose either of:
      1. use WTSGetActiveConsoleSessionId() to find out if the session the Home Server Console application is running on is the same as the session that is the server's physical console session
      2. use WTSQuerySessionInformation() to find out the name of the machine connected to the session and compare it to the name of the Windows Home server

    See how you go!

    Thursday, July 26, 2007 11:19 AM

All replies

  • You might be able to retrieve the information you're looking for using the Terminal Services API.
    Friday, July 20, 2007 12:26 AM
    Moderator
  •  

    I still can't figure out how to differentiate between the console being displayed on a client and a user connecting to the server through a RDP session and then running the console from the server's desktop (I want to treat this as being run from the server).
    Thursday, July 26, 2007 1:35 AM
  •  

    This is completely untested, and from a cursory glance at the Terminal Services API -

    1. Get the handle to Home Server Console process on the server
    2. Use GetProcessId() to get id of the process
      --> if you're doint this in an add-in then GetCurrentProcessId() will shorten the above to one step
    3. Use ProcessIdToSessionId() to get the id of the session the process is running on
    4. choose either of:
      1. use WTSGetActiveConsoleSessionId() to find out if the session the Home Server Console application is running on is the same as the session that is the server's physical console session
      2. use WTSQuerySessionInformation() to find out the name of the machine connected to the session and compare it to the name of the Windows Home server

    See how you go!

    Thursday, July 26, 2007 11:19 AM
  •  Bezalel Geretz wrote:

     

    I still can't figure out how to differentiate between the console being displayed on a client and a user connecting to the server through a RDP session and then running the console from the server's desktop (I want to treat this as being run from the server).

     

    One idea that I have is to check if explorer is being run in the same session as the console.

    Thursday, July 26, 2007 5:52 PM