Search code examples
iisiis-7application-poolotterotter-script

How do I get an IIS application pool to not start when it is created by Otter?


Note: I'm very new to Otter script so if this is simple then I apologize in advance!

Here is the main nugget of the script I've got now:

IIS::Ensure-AppPool(
    Name: LonTest,
    Credentials: SVC_LonTest1,
    AutoStart: false,
    QueueLength: 1500,
    Pipeline: Integrated,
    Runtime: v4.0
);

Otter does create the app pool, but it is always started even though the docs seem to indicate that "AutoStart: false" should change the value of the "Start application pool immediately" checkbox in the Basic Settings of the app pool.

What do I need to do here to make sure that value is unchecked and that the app pool is initially stopped when it is created?


Solution

  • The AutoStart property changes as soon as you start or stop an application pool. You can see this if you right-click on the app pool in IIS Manager and select Basic Settings, the "Start application pool immediately" checkbox you mentioned will be checked or unchecked if the app pool is started or stopped respectively, and will flip its state if you start or stop the app pool.

    The property I believe you want is the State property:

    IIS::Ensure-AppPool(
        Name: LonTest,
        Credentials: SVC_LonTest1,
        State: Stopped,
        QueueLength: 1500,
        Pipeline: Integrated,
        Runtime: v4.0
    );
    

    This will ensure that the application pool is created but not running on the server you've configured with this script. When you're ready to start it, simply update the script, or consider using a server variable for the State value.