【问题标题】:Generating RDP file on the fly即时生成 RDP 文件
【发布时间】:2009-11-19 09:40:29
【问题描述】:

我想创建一个类似于 TS Web Access 的 Web 应用程序,我可以在其中为服务器上配置的远程应用程序动态创建 rdp 文件。有什么想法吗??

【问题讨论】:

    标签: remote-desktop terminal-services rdp


    【解决方案1】:

    我们必须做这件事。

    private void InvokeRDPSign(String fileName, String certificateThumbPrint)
    {
        Process signingProcess = new Process();
        signingProcess.StartInfo.FileName = @"rdpsign.exe";
    
        String arguments = String.Format("/sha1 {0} {1}", certificateThumbPrint, fileName);
        signingProcess.StartInfo.Arguments = arguments;
        signingProcess.StartInfo.UseShellExecute = false;
        signingProcess.StartInfo.RedirectStandardOutput = true;
        signingProcess.StartInfo.WorkingDirectory = Environment.SystemDirectory;
        signingProcess.Start();
    
        String signingOutput = signingProcess.StandardOutput.ReadToEnd();
        signingProcess.WaitForExit();
        int exitCode = signingProcess.ExitCode;
        //TODO:  should we throw an error if the exitcode is not 0
    }
    

    请注意,每个版本的 Windows 上的 RDPSign.exe 都不同。您会发现该实用程序的旧版本将忽略签名中的新设置。

    【讨论】:

    • 我必须为应用程序池身份使用提升的帐户才能完成这项工作。正如其他帖子所建议的那样,我可能会将此代码移动到具有提升权限的机器上的服务中,而不是永久更改应用程序池标识。
    【解决方案2】:

    好吧,查看“rdp”文件后,内容如下:

    screen mode id:i:2
    desktopwidth:i:1280
    desktopheight:i:768
    session bpp:i:32
    winposstr:s:2,3,1430,104,2230,704
    compression:i:1
    keyboardhook:i:2
    displayconnectionbar:i:1
    disable wallpaper:i:1
    disable full window drag:i:1
    allow desktop composition:i:0
    allow font smoothing:i:0
    disable menu anims:i:1
    disable themes:i:0
    disable cursor setting:i:0
    bitmapcachepersistenable:i:1
    full address:s: [YOUR IP]
    audiomode:i:0
    redirectprinters:i:1
    redirectcomports:i:0
    redirectsmartcards:i:1
    redirectclipboard:i:1
    redirectposdevices:i:0
    autoreconnection enabled:i:1
    authentication level:i:0
    prompt for credentials:i:0
    negotiate security layer:i:1
    remoteapplicationmode:i:0
    alternate shell:s:
    shell working directory:s:
    gatewayhostname:s:
    gatewayusagemethod:i:4
    gatewaycredentialssource:i:4
    gatewayprofileusagemethod:i:0
    promptcredentialonce:i:1
    drivestoredirect:s:
    

    只需将其创建为字符串,看起来很简单。

    ps 我不知道'winposstr' 参数是什么...

    【讨论】:

    • 这很好,但是我的远程应用程序使用证书进行了数字签名,这在我的 rdp 文件中添加了 2 个附加参数:1.signscope:s 2.signature:s 如何为这些创建值参数,这些是使用 SHA1 哈希...???
    • 我不知道这些证书是怎么回事。你不能创建一个有效的“远程应用程序”RDP,然后复制那个签名吗?还是每次sig都不一样?
    • 签名每次都是一样的,但我要打开差异。差异按钮上的应用程序,并且签名取决于远程应用程序程序名称,因此我可以即时更改签名。示例 rdp 文件内容:
    • span 监视器:i:1 提示客户端上的凭据:i:1 远程应用程序模式:i:1 服务器端口:i:3389 允许字体平滑:i:1 promptcredentialonce:i:1 身份验证级别:i :0 gatewayusagemethod:i:2 gatewayprofileusagemethod:i:0 gatewaycredentialssource:i:0 full address:s:LUTRONTS1 备用 shell:s:||TSClient_TS2 remoteapplicationprogram:s:||TSClient_TS2 gatewayhostname:s: remoteapplicationname:s:TSClient_TS2 remoteapplicationcmdline:s :
    • signscope:s:Full Address,Server Port,GatewayHostname,GatewayUsageMethod,GatewayProfileUsageMethod,GatewayCredentialsSource,PromptCredentialOnce,Alternate Shell,RemoteApplicationProgram,RemoteApplicationMode,RemoteApplicationName,RemoteApplicationCmdLine,Authentication Level,RedirectDrives,RedirectPrinters,RedirectCOMPorts,RedirectSmartCards, RedirectPOSDevices,RedirectClipboard,DevicesToRedirect,DrivesToRedirect
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-09
    • 1970-01-01
    • 2019-01-07
    • 2010-12-27
    相关资源
    最近更新 更多