I would like to use following code to make sure my Clickonce application is always started without admin rights
But the sut is not started when ranorex is running as admin:
using System.Security.Principal; //needed for IsAdministrator() public void RunMy_application() { // old code Host.Local.RunApplication("C:\\Windows\\System32\\rundll32.exe", "C:\\Windows\\System32\\dfshim.dll,ShOpenVerbApplication "+ MySutAddress, "",false); var MyAppflag = RunAppFlags.None; if (IsAdministrator()) { MyAppflag = RunAppFlags.NoElevation; } Host.Local.RunApplication("C:\\Windows\\System32\\rundll32.exe", "C:\\Windows\\System32\\dfshim.dll,ShOpenVerbApplication "+ MySutAddress, "",false , MyAppflag); } public static bool IsAdministrator() { using (WindowsIdentity identity = WindowsIdentity.GetCurrent()) { WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole(WindowsBuiltInRole.Administrator); } }Anyone have an idea how to solve this ?
Regards,
Don