2017-05-24 10 views

답변

0

연결중인 현재 사용자의 모든 RDP 환경 변수 목록은 아래 주석을 참조하십시오. 시트릭스 ICA 연결을위한

등록 위치는 참조 연결하는 장치의 종류를 줄 것이다

하위 키 ClientProductID 및하여 clientType \ 시트릭스 \ 이카 \ 세션 \\ 연결 \ HKEY_LOCAL_MACHINE \ 소프트웨어입니다.

다음은 원격 세션을 가져온 다음 regedit에서 세션 정보를 가져 오는 몇 가지 기본 코드입니다.

// Prints out ICA or RDP session ID of current user & gets ICA session ClientType variable 

using System; 
using Microsoft.Win32; 

namespace ViaRegedit 
{ 
    class Program03 
    { 
     static void Main(string[] args) 
     { 
      // Obtain an instance of RegistryKey for the CurrentUser registry 
      RegistryKey rkCurrentUser = Registry.CurrentUser; 
      // Obtain the test key (read-only) and display it. 
      RegistryKey rkTest = rkCurrentUser.OpenSubKey("Remote"); 

      foreach (string valueName in rkTest.GetSubKeyNames()) 
      { 
       //Getting path to RDP/Citrix session ID 
       string RDPICApath = ""; 
       if (rkTest.OpenSubKey(valueName) != null && rkTest.OpenSubKey(valueName) != null) { RDPICApath = rkTest.OpenSubKey(valueName).ToString(); } 
       Console.WriteLine("Getting CurrentUser ICA-RDP path from string = " + RDPICApath); 

       //List<string> RDPICAnumber = RDPICApath.Split('\\').ToList(); 
       string RDPICAnumber = RDPICApath.Substring(RDPICApath.LastIndexOf('\\') + 1); 
       Console.WriteLine("Current User RDPICAnumber = " + RDPICAnumber); 

       //Getting reg local machine info for Citrix based on RDP/Citrix session ID "RDPICAnumber" 
       string regLocal = @"SOFTWARE\Citrix\Ica\Session\" + RDPICAnumber + @"\Connection"; 
       RegistryKey localKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64); 
       RegistryKey citrixKey = localKey.OpenSubKey(regLocal); 
       Console.WriteLine("Registry " + citrixKey + " Does Exist - going to get ClientType"); 
       //getting clietAddress var from citrixKey 
       string clientType = ""; 
       if (citrixKey != null && citrixKey.GetValue("clientType") != null) 
        {clientType = citrixKey.GetValue("ClientType").ToString();} 
        Console.WriteLine("Getting current user clientType from string = " + clientType); 
      } 
      rkTest.Close(); 
      rkCurrentUser.Close(); 
      Console.ReadLine(); 
     } 
    } 

} 

쉽게 ClientProductID로하여 clientType을 교체하고 ClientProductID information.

enter image description here

+0

들으을 받고 다음과 같은 기준을 사용하지만, 난'는 윈도우 서버 2016이 아닌 시트릭스 서버를 사용 할 수있다. –

+0

안녕하세요. 연결중인 현재 사용자의 모든 RDP 환경 변수 목록을 보려면 다음 명령을 참조하십시오. os 유형을 찾거나 OS 및 CLIENTNAME에 장치 초점을 연결하는 경우 인쇄물의 차이점을 확인하려면 Mobile/Windows RDP 연결간에 통보하십시오. 'foreach (Environment.GetEnvironmentVariables (EnvironmentVariableTarget.Process)의 DictionaryEntry de) { 문자열 로그 = "\ r \ n"+ de.Key + "="+ de.Value; Console.WriteLine ("{0} = {1}", de.Key, de.Value); }' – BrettKennard

+0

안녕하세요, 나는 모든 EnvironmentVariables를 검사했습니다. 하지만 저는 항상 Real-Client가 아닌 WindowsServer Session에서 Infos를 얻습니다. OS = Windows_NT CLIENTNAME이 (가) 나를 위해 작동하지 않습니다. –