"Could you please add us to the local admin group? Apparently ANT requires local admin rights in order to run."
Hmmm, let me ponder this question for a moment, NO. So, what do we do. Again, .NET comes to the rescue with the Process class. Whip up a few lines of C# code, obfuscate the exe, then ask them to run the executable which worked wonderfully. They were now running this particular process as a local admin, without being an admin.
static void Main(string[] args)
{
string pw = "*****";
SecureString secureString = new SecureString();
foreach (char ch in pw)
{
secureString.AppendChar(ch);
}
Process procLaunch = new Process();
procLaunch.StartInfo.UseShellExecute = false;
procLaunch.StartInfo.UserName = "localadminaccount";
procLaunch.StartInfo.Password = secureString;
procLaunch.StartInfo.FileName = @"pathtoexe";
procLaunch.Start();
}
No comments:
Post a Comment