views:

14

answers:

1

I have a custom action that I'm using to deploy some files that sit next to the msi in the handoff package. My custom action is passed the msi path via the OriginalDatabase parameter and I'm checking to see if there is a folder next to it. Nothing too crazy but was a pain in the butt to figure out.

Installing single or multiple users from files copied locally works like a champ. Installing single user when running the setup.exe from a network share works fine however when I install all users from a network share I'm getting a security exception.

The line in question is this:

DirectoryInfo[] subdirectories = workingDirectoryInfo.GetDirectories("Foo");

The custom action runs with SecurityAction.Demand so I should have all the access I need.

Any input anyone can provide is greatly appreciated.

Thanks, Casey

A: 

I believe when you install per-user the server side doesn't need to elevate to do the transaction so it impersonates the interactive user and can access the files. When you install for all-users it has to elevate so now it's basically running as system which would use the machine account to access the files and boom you get a permissions error.

May I ask why these files aren't in your installer? Is there not some way you can include them so you don't have to have the custom action? Otherwise you might have to write a custom action that detects the OriginalDatabase is on a network share and prevent the install unless the user copies all of the files down before running.

Christopher Painter
Hi Christopher, thanks for the response. It is indeed a permissions issue related to running as System. The files outside of the msi may change per deployment so the the custom action was used in order to avoid needing to do a custom msi for different deployments.Thanks for the response and the suggestion of disabling the copy if running all users from a network. I think it's a good one and probably what we'll end up doing.
Casey Margell

related questions