removing created user and service on rollback - Advanced Installer Community
scambias
Posts: 29
Joined: Tue Nov 19, 2019 3:26 pm

removing created user and service on rollback

Hi all,

during my installation I have to create a user (and a service run by it).
I assign some nt rights to this user via an inline script and this works fine but in some condition I may encounter an error (somewhere else) during the installation and I have to rollback to initial conditions.
I therefore would like to have a rollback step that removes that user. I noticed that there is no built-in option in the user creation page. How can I achieve this? I guess through a custom action. A VBS script?
Thank you in advance!
Silvio
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: removing created user and service on rollback

Hello Silvio,
I therefore would like to have a rollback step that removes that user. I noticed that there is no built-in option in the user creation page.
Indeed, you are right. We currently do not offer predefined support for this.
How can I achieve this? I guess through a custom action. A VBS script?
Yes, this can be achieved through a custom action that will undo the changes (e.g. delete the created user). The custom action can be of any type (e.g. VBScript, PowerShell, C#, etc.).

One thing to keep in mind here would be the fact that your custom action should have its execution time set to "During installation rollback" and it should be scheduled, in the installation sequence, after the action that creates the user. The action that creates the user takes place between "AllocateRegistrySpace" and "ProcessComponents" standard actions (which are part of the "Preparing" action group).

In order to display the above mentioned standard actions, please go to "Custom Actions" page , right click on the "Preparing" action group --> "Show Standard Actions" --> "Preparing" --> click on "AllocateRegistrySpace".

Now please repeat the above step for the "ProcessComponent" as well.

(Enterprise or above project type required): In order to schedule your custom actions between those, simply drag and drop it. In order to make sure that your custom action is executing "after" the action that creates the user, please go to "Table Editor" page --> "InstallExecuteSequence" table --> click on the "Sequence" column (to order the actions by their sequence) --> look for the "AI_ProcessAccounts" action. Make sure that your custom action has a higher sequence number that the one of the "AI_ProcessAccounts" custom action.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”