Restart during an action

(imported topic written by SystemAdmin)

I have a installation task I’m attempting to create that could require a restart during the action (CRM 2011). I’ve attempted to use the restart 300 command in my action, however It does not seem to run.

I know an action cannot be picked up after a restart. I really don’t want to make this a baseline. So I though I could just add restart commands at various parts of my action and have it retry several times. The problem is the restart command isn’t working (no prompt to restart).

I have the following statement in my action before installation, after prereqs are installed and after installation. I never seem to get the restart message, even though my if statement evaluates as true.

//restart if needed

if {pending restart}

restart 300

continue if {not pending restart}

endif

The thought is if the computer needs to restart it will and the task would fail. I would then have the action retry after the restart.

My if statement works, the continue if works (I see the line fail). However the user never gets prompted to restrart.

Any idea’s? I want need the user to be notified of the restart.

(imported comment written by SystemAdmin)

I believe your continue if {not pending restart} is actually preventing the restart from happening.

If you remove that then the action could “complete” successfully then.

I believe the restart actually occurs at the end of the action so it needs to complete successfully to do so.

(imported comment written by SystemAdmin)

Thanks Alan, that resolved the issue. I just removed the continue if statements and had the action end if it was pending a restart. The task performs as desired now.