VB.NET RegSvr32

I have a program that basically installs a bunch of files that sit on a Server onto the user's local machine. These files include .dlls and ocx files that are used by an VB 6 Application and they must be registered on the local machine. The issue is with a user who doesn't have poweruser or local admin rights (Windows XP). With just this normal user profile, the program cannot successfully run the program, because the regsvr32 <dll> or <ocx> commands fail. Using a Windows Installer will not work for this type of application design.

Any way to run the program with elevated permissions without coding in a local admin password. The problem is that this program has to run under the Projects security policy, meaning normal users essentially can't install any software.

Any clues.. Can't really create this as a windows service because there is a GUI component and this program needs to run on the users machine. Basically the regsvr32 command writes entries into the registry that a normal user does not have access to.

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zljkCommented: 2003-11-11

Hi,

I wrote the similar code recently, having the same problems as u do. There is no workaround except storing somewhere encrypted admin password, or doing it as a service. If u store admin password somewhere, you can use WIN32 API CreateProcessWithLogon to run a new instance of the app, this time with administrative privileges:

Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type

Private Type STARTUPINFO
cb As Long
lpReserved As Long
lpDesktop As Long
lpTitle As Long
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Byte
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type

That's it. If MS would allow anyone to override security policy, that wouldn't be a security policy anyway :) So you do need username and password of the user that has rights to install new components, or u must run app under local system account - as a service (that is installed by an administrator anyway).

Ok. I think that's the way I'll go. One more thing. What's the best way to encript then unencript the userid and password, so that I can use in the program.

freemanjennifer04Commented: 2004-07-12

The problem with logging in as an Administrator and registering the component manually is that we have over 2,000 computers and we have 10 offices globally. That is definitely not an option unfortunately. Thanks.