rdp 密码生成 java_远程桌面 Rdp文件的生成

该代码段展示了如何在Java中创建一个RDP配置文件,包括设置屏幕模式、分辨率、颜色深度,并添加远程桌面的地址、用户名和密码。通过这个文件,用户可以方便地进行远程桌面连接。
摘要由CSDN通过智能技术生成

private static void rdpProfile(string filename, string address, string username, string password, stringcolordepth)

{if(File.Exists(filename))

{

File.Delete(filename);

}using (StreamWriter streamWriter = new StreamWriter(filename, true))

{

streamWriter.WriteLine("screen mode id:i:2");

streamWriter.WriteLine("desktopwidth:i:0");

streamWriter.WriteLine("desktopheight:i:0");

streamWriter.WriteLine("session bpp:i:" +colordepth);

streamWriter.WriteLine("winposstr:s:0,1,0,0,1234,792");

streamWriter.WriteLine("compression:i:1");

streamWriter.WriteLine("keyboardhook:i:2");

streamWriter.WriteLine("audiocapturemode:i:0");

streamWriter.WriteLine("videoplaybackmode:i:1");

streamWriter.WriteLine("connection type:i:6");

streamWriter.WriteLine("displayconnectionbar:i:1");

streamWriter.WriteLine("disable wallpaper:i:1");

streamWriter.WriteLine("allow font smoothing:i:1");

streamWriter.WriteLine("allow desktop composition:i:1");

streamWriter.WriteLine("disable full window drag:i:1");

streamWriter.WriteLine("disable menu anims:i:1");

streamWriter.WriteLine("disable themes:i:1");

streamWriter.WriteLine("disable cursor setting:i:0");

streamWriter.WriteLine("bitmapcachepersistenable:i:0");

streamWriter.WriteLine("full address:s:" +address);

streamWriter.WriteLine("audiomode:i:0");

streamWriter.WriteLine("redirectprinters:i:0");

streamWriter.WriteLine("redirectcomports:i:0");

streamWriter.WriteLine("redirectsmartcards:i:0");

streamWriter.WriteLine("redirectclipboard:i:1");

streamWriter.WriteLine("redirectposdevices:i:0");

streamWriter.WriteLine("redirectdirectx:i:1");

streamWriter.WriteLine("drivestoredirect:s:");

streamWriter.WriteLine("autoreconnection enabled:i:1");

streamWriter.WriteLine("authentication level:i:2");

streamWriter.WriteLine("prompt for credentials:i:0");

streamWriter.WriteLine("negotiate security layer:i:1");

streamWriter.WriteLine("remoteapplicationmode:i:0");

streamWriter.WriteLine("alternate shell:s:");

streamWriter.WriteLine("shell working directory:s:");

streamWriter.WriteLine("gatewayhostname:s:");

streamWriter.WriteLine("gatewayusagemethod:i:4");

streamWriter.WriteLine("gatewaycredentialssource:i:4");

streamWriter.WriteLine("gatewayprofileusagemethod:i:0");

streamWriter.WriteLine("promptcredentialonce:i:1");

streamWriter.WriteLine("use redirection server name:i:0");

streamWriter.WriteLine("use multimon:i:0");if (!string.IsNullOrEmpty(username))

{

streamWriter.WriteLine("username:s:" +username);

}if (!string.IsNullOrEmpty(password))

{

streamWriter.WriteLine("password 51:b:" +password);

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值