Vista\Win7 - Is it possible to shell and specify an account to run the process under?
-
Vista\Win7 - Is it possible to shell and specify an account to run the process under? Scenario: our company has a program that is a launcher app (kinda like a fancy version of click-once). Based on the arguements passed in, it determines what program the user is trying to run and what files need to be updated (controls, .dlls, etc), pulls them down from a shared directory and registers them (regsvr32 or regasm). After that process is done, the program that was requested is launched via shellex. In Vista and Win7 the regsvr32 and regasm functionality is broken because of UAC. The user has admin rights to only 1 folder in the Program Files directory (that is the location where the .dlls, etc are pulled down to). Is there a way to perform a shell (so that regsvr32 can be run) using a admin account (specifying user and password in code)?
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
-
Vista\Win7 - Is it possible to shell and specify an account to run the process under? Scenario: our company has a program that is a launcher app (kinda like a fancy version of click-once). Based on the arguements passed in, it determines what program the user is trying to run and what files need to be updated (controls, .dlls, etc), pulls them down from a shared directory and registers them (regsvr32 or regasm). After that process is done, the program that was requested is launched via shellex. In Vista and Win7 the regsvr32 and regasm functionality is broken because of UAC. The user has admin rights to only 1 folder in the Program Files directory (that is the location where the .dlls, etc are pulled down to). Is there a way to perform a shell (so that regsvr32 can be run) using a admin account (specifying user and password in code)?
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
-
Try launching regsvr32 like this:
System.Diagnostics.Process.Start("regsvr32.exe", username, password, domain);
I tried your suggestion but was unsuccessful.
Process.Start("C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe", """" & "C:\Program Files\CompanyApp\System\dbDAL.dll" & _
"""" & " /codebase", "AdminAcct", pw, "Domain")The exit code = 100. Nothing errors off, but the assembly isn't registered correctly and can't be instantiated. If I run the SDK command prompt in adminstrative mode and run the same command and arguments, then the object and be instantiated correctly. Despite specifying the admin account, UAC appears to be blocking the registering. Sigh.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
-
I tried your suggestion but was unsuccessful.
Process.Start("C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe", """" & "C:\Program Files\CompanyApp\System\dbDAL.dll" & _
"""" & " /codebase", "AdminAcct", pw, "Domain")The exit code = 100. Nothing errors off, but the assembly isn't registered correctly and can't be instantiated. If I run the SDK command prompt in adminstrative mode and run the same command and arguments, then the object and be instantiated correctly. Despite specifying the admin account, UAC appears to be blocking the registering. Sigh.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
I was browsing around for this problem and found the following post (don't know if it's reliable): http://www.icodefactory.com/lab/post/UAC-Revealed-7e-elevation-of-rights-from-NET-as-commonly-misunderstood.aspx[^] I still think that even if this is true it should be possible to use the Windows API to somehow elevate the process, but I am not sure.