0
원격 IE를 시작하는 코드가 있습니다. "관리자 권한으로 실행"옵션을 사용하여 응용 프로그램을 시작하고 싶습니다.
어떻게 이것을 달성 할 수 있습니까?C# 원격 데스크톱 응용 프로그램을 관리자로 실행하십시오.
private static void StartSession(string hostName)
{
var filespec = Path.Combine(GetRootFolderSpec(), "session.rdp");
if (File.Exists(filespec)) File.Delete(filespec);
var settings = GetRdpSettings(hostName);
File.WriteAllText(filespec, settings);
File.SetAttributes(filespec, FileAttributes.Hidden);
Process.Start(filespec);
}
private static string GetRdpSettings(string hostName)
{
return @"redirectclipboard:i:1
redirectposdevices:i:0
redirectprinters:i:0
redirectcomports:i:1
redirectsmartcards:i:0
devicestoredirect:s:
drivestoredirect:s:
session bpp:i:32
prompt for credentials on client:i:1
span monitors:i:1
use multimon:i:1
remoteapplicationmode:i:1
server port:i:1111
allow font smoothing:i:1
screen mode id:i:1
smart sizing:i:1
promptcredentialonce:i:1
authentication level:i:2
gatewayusagemethod:i:2
gatewayprofileusagemethod:i:0
gatewaycredentialssource:i:0
full address:s:" + hostName + @"
alternate shell:s:||iexplore
remoteapplicationprogram:s:||iexplore
gatewayhostname:s:
remoteapplicationname:s:iexplore.exe
remoteapplicationcmdline:s:";
}
대상 컴퓨터의 제어를 대신 IE의 실행 할 수있는 다른 소프트웨어를 추가 할 수 있습니까? (예를 들어,'alternate shell' 매개 변수를 위해 당신 자신의 프로그램을 사용하고 IE가 올라가고 나서 그것을 닫을 때까지 기다려야합니다.). 또한 이것이 IE 이외의 다른 응용 프로그램이라면, 나는 당신이 더 많은 옵션을 가지고 있다고 생각합니다. 당신은 항상 IE를하고 있습니까? 아니면이 예제를 위해 IE를 선택 했습니까? –
감사합니다. 내가 처리하고있는 프로젝트에서 IE를 사용하는 것이 필수적입니다. 대상 컴퓨터는 고객마다 다를 수 있습니다. 따라서 하드 코드도 생략 할 수 있습니다. – zeetit
잠시만 기다려주십시오. mstsc.exe (원격 데스크톱 프로그램)를 관리자로 실행 하시겠습니까, 아니면 관리자로 연결하고있는 서버에서'iexplore.exe'를 실행 하시겠습니까? –