Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Custom action to run as server


1 reply to this topic

aarthi_m

aarthi_m
  • Full Members
  • 65 posts

Posted 30 August 2006 - 11:17

On longhorn, i want to execute one of my custom action with elevated privileges. The custom action writes into the windows folder which requires admin privileges. My guess is that if the custom action runs as server (ie.. msiexec service which runs as SYSTEM), the problem should be solved. The custom action will be able to write to windows folder.

But, how do i execute the action as server? I can't set the execution to deffered execution in system context as i dont want the custom action to be a deffered action.



Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 30 August 2006 - 12:30

Immediate mode custom actions always run in user context, there is no way to make them run with elevated rights. The problem with running custom actions in deferred mode is that you have to write the value of any properties you need into the execution script using the CustomActionData property, you can't use Session.Property or MsiGetProperty. The procedure to achieve this is thoroughly described in the SDK. In essence you will need an immediate mode custom action that sets a property that has the same name as the deferred mode custom action to the value you want to write into the execution script:

Immediate Mode:
Custom Action Name: RememberInstalldir
Custom Action Type: Set Property
Property: DoStuff
Property Value: [INSTALLDIR]

Deferred Mode:
Custom Action NAme: DoStuff
Script File: Test.vbs
Script Extract:

' Read stored INSTALLDIR property value (we are in deferred context)
TheInstallDir = Session.Property("CustomActionData")

Regards
-Stein Åsmul