Example #1
0
        /// <summary>
        /// Gets list of the sessions on the terminal server.
        /// </summary>
        /// <returns>A list of sessions.</returns>
        public List <TerminalServicesSession> GetSessions()
        {
            this.CheckDisposed();

            var results = new List <TerminalServicesSession>();

            var sessionInfos = NativeMethodsHelper.GetSessionInfos(this.Handle);

            foreach (WTS_SESSION_INFO sessionInfo in sessionInfos)
            {
                results.Add(new TerminalServicesSession(this, sessionInfo));
            }

            return(results);
        }