This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Help executing from mapped drive with UAC
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 04, 2011
09:38 AM
Help executing from mapped drive with UAC
I have a custom action that calls an InstallScript function to copy files from a resource folder relative to my MSI file and place them on the target system. This custom action executes as Deferred in System Context. The system context is needed because the files will fail to be copied if UAC is enabled. However, the customer also wants to be able to install from a mapped network drive. This is a problem, because custom actions running Deferred in System Context will fail to access network shares because they are running under the SYSTEM account, (in SMB terminology a 'NULL User') which is disallowed in Windows.
So, it seems if I have my custom action run in system context, it will fail to install from a network location. If I have it as non-system, it fails due to UAC restrictions. Is there a way to satisfy both of these customer demands? (1. Install from a mapped network drive 2. Install with UAC enabled)
It seems like I've hit a catch-22 or something.
So, it seems if I have my custom action run in system context, it will fail to install from a network location. If I have it as non-system, it fails due to UAC restrictions. Is there a way to satisfy both of these customer demands? (1. Install from a mapped network drive 2. Install with UAC enabled)
It seems like I've hit a catch-22 or something.
(7) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 04, 2011
01:20 PM
The only approach here that really works is to do both - copy to a local temporary location with the user context action, then run from the local copy in the deferred system context action. Of course then you also will want to clean up the copy...
(Technically you can read it in an immediate action and pass it through CustomActionData, but depending on the size of the file, that seems like an odd approach to me.)
(Technically you can read it in an immediate action and pass it through CustomActionData, but depending on the size of the file, that seems like an odd approach to me.)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 04, 2011
04:06 PM
I didn't think I could use a custom action to copy it to the local system if UAC is enabled and the action is not in system context. The reason I have it set as executing in system context is because the UAC prevented me from writing files.
Is this not true?
Is this not true?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 04, 2011
06:22 PM
A custom action needs to execute with elevated privilege, not necessarily in system context, to copy files to restricted parts on a machine.
Why do you want to use a custom action to copy files? Files copied in this manner will not be removed by default during uninstallation or rollback without a separate custom action. Is there any reason that these files are not in components, which Windows Installer will copy via InstallFiles action?
Why do you want to use a custom action to copy files? Files copied in this manner will not be removed by default during uninstallation or rollback without a separate custom action. Is there any reason that these files are not in components, which Windows Installer will copy via InstallFiles action?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 07, 2011
12:55 PM
They are included alongside the MSI on the target system, so I can't use InstallFiles. However, I am now using MoveFiles to copy them. How would I get a custom action to execute with elevated privileges when specified only as Deferred? My InstallScript action fails for me when I don't have it as executing in system context.
By the way, I've noticed there seems to be some sort of stigma with using custom actions. Aside from the fact that you need to create corresponding rollback and uninstall actions (which I have easily done), is there some problem with using custom actions to programmatically accomplish a task, such as copying files? Or is it just the extra burden of manually having to ensure uninstall and rollback is taken care of properly?
By the way, I've noticed there seems to be some sort of stigma with using custom actions. Aside from the fact that you need to create corresponding rollback and uninstall actions (which I have easily done), is there some problem with using custom actions to programmatically accomplish a task, such as copying files? Or is it just the extra burden of manually having to ensure uninstall and rollback is taken care of properly?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 07, 2011
07:41 PM
Deferred execution would be elevated (see Installation Mechanism). Running in system context is to run without user impersonation. You will need to determine where exactly (which line) your custom action fails.
Adding a custom action complicates installation and introduces a potential point of failure/bug, not just during installation, uninstallation and rollback. It would potentially have some effects on (minor/major) upgrade and/or patch in the future. So, for functionalities, such as file copy, that Windows Installer already provdes, it is best not to reinvent the wheel.
Adding a custom action complicates installation and introduces a potential point of failure/bug, not just during installation, uninstallation and rollback. It would potentially have some effects on (minor/major) upgrade and/or patch in the future. So, for functionalities, such as file copy, that Windows Installer already provdes, it is best not to reinvent the wheel.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 08, 2011
10:51 AM
I have a custom action that fails on calling the InstallScript RegDB functions to create a registry key if UAC is enabled. If I execute it as in system context, it works.
I can't use the built-in registry editor in the IDE because it doesn't have the flexibility that is needed. My registry keys are installed under a key that is potentially shared by other apps. If my app is the first installed, it will create this common key. But what happens during uninstallation is it deletes that common key (and all the keys from other apps under it) if it created that key in the first place. I didn't see an option to prevent this behavior, so I resorted to using an IS custom action.
I can't use the built-in registry editor in the IDE because it doesn't have the flexibility that is needed. My registry keys are installed under a key that is potentially shared by other apps. If my app is the first installed, it will create this common key. But what happens during uninstallation is it deletes that common key (and all the keys from other apps under it) if it created that key in the first place. I didn't see an option to prevent this behavior, so I resorted to using an IS custom action.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 08, 2011
04:56 PM
Looks like I was wrong. Make it deferred in system context then.
Registry entries are gated by component, which is reference counted by Windows Installer. Perhaps, you can try to find a common denominator for your registry entries and group them in common component(s) which is(are) then included in the projects.
Registry entries are gated by component, which is reference counted by Windows Installer. Perhaps, you can try to find a common denominator for your registry entries and group them in common component(s) which is(are) then included in the projects.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)