0
나는 아래 코드를 시도했지만 잘 작동하지만 지금은 암호를 전달하고 rdp connection.everytime을 열 때 발생하는 팝업 메시지를 사용 안 함으로 설정합니다. sw.WriteLine("password 51:b:" + password);
오류가 발생했습니다. 말 발생하는 "오류가 파일 c 다운로드 할 수 없습니다 : \의 temp.rdp을"smtsc 양식 C# 코드
public static void RdcTest(String server,String UserName,String password)
{
string filename = @"c:\temp.rdp";
if (!File.Exists(filename))
{
using (FileStream fs = File.Create(filename))
using (StreamWriter sw = new StreamWriter(fs))
{
sw.WriteLine("screen mode id:i:2");
sw.WriteLine("desktopwidth:i:1440");
sw.WriteLine("desktopheight:i:900");
sw.WriteLine("session bpp:i:32");
sw.WriteLine("winposstr:s:0,1,4,12,1440,864");
sw.WriteLine("compression:i:1");
sw.WriteLine("keyboardhook:i:2");
sw.WriteLine("displayconnectionbar:i:1");
sw.WriteLine("disable wallpaper:i:1");
sw.WriteLine("disable full window drag:i:1");
sw.WriteLine("allow desktop composition:i:0");
sw.WriteLine("allow font smoothing:i:0");
sw.WriteLine("disable menu anims:i:1");
sw.WriteLine("disable themes:i:0");
sw.WriteLine("disable cursor setting:i:0");
sw.WriteLine("bitmapcachepersistenable:i:1");
sw.WriteLine("full address:s:" + server);
sw.WriteLine("username:s:" + UserName);
//sw.WriteLine("password 51:b:" + password);
sw.WriteLine("audiomode:i:0");
sw.WriteLine("redirectprinters:i:1");
sw.WriteLine("redirectcomports:i:0");
sw.WriteLine("redirectsmartcards:i:1");
sw.WriteLine("redirectclipboard:i:1");
sw.WriteLine("redirectposdevices:i:0");
sw.WriteLine("autoreconnection enabled:i:1");
sw.WriteLine("authentication level:i:0");
sw.WriteLine("prompt for credentials:i:0");
sw.WriteLine("negotiate security layer:i:1");
sw.WriteLine("remoteapplicationmode:i:0");
//sw.WriteLine("domain:s:" + domain);
}
Process rdcProcess = new Process();
string strExE = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe");
rdcProcess.StartInfo.FileName = strExE;
rdcProcess.StartInfo.Arguments = filename;
rdcProcess.Start();
}
}
어떤 도움?
파일이 successfuly로 생성되었습니다. –
문제는 행에만 있습니다. sw.WriteLine ("password 51 : b :"+ password); 나는 모든 일이 잘 달렸다고 논평하지만 그것을 가능하게 할 때 나는 오류 메시지를 받았다. –