Ask A Question

View Question

I need the ability to execute Restart-Server when executing Server Configuration plans. I am installing a series of heavy-weight installers (VS2017, SQL Server etc.) Often these installers either require the server is rebooted before starting the install, or after the install. I check for the server's reboot status before installing each package. If a reboot is required, then I would like to reboot. I am finding that the Restart-Server operation is not executed in configuration plans. It does work from Orchestration plans as expected.

Is there a recommended way to accomplish what I need to do?

Product: Otter
Version: 1.5.5

The Restart-Server operation is a Execute operation, which means it will only execute in a block where drift is detected.

Thanks Alana, that is what I arrived at as well. Is there a way to execute a block of OtterScript during execution when drift is detetected. Basically what I would like to do is:

1. If drifted is detected during collection phase:
     a. During Configuration phase
           1. Call OtterScript template (to disable TeamCity agent)
           2. Call OtterScript template to reboot if required
           3. Call OtterScript template to install chocolatey package
           4. Call OtterScript template (to enable TeamCity agent)

To do this, use the Execution Directive statement and set the Execution Policy to Always.

with executionPolicy=always 

That block will behave as if drift occurred within it.

Thanks Alex! I think I was told that before, but forgot about it. For future reference, is this in the Otter documentation?

It is, albeit a bit buried in the formal specification.

Answer Question