Copy an IIS7 Application Pool

Today I needed to create a .NET v4.0 version of an existing application pool. The old app pool was installed by a vendor install and uses a custom identity that gives it access to the vendor’s application. I don’t know the password to the custom identity, so I couldn’t create a new app pool from scratch.

I wondered about copying and modifying .config files, but this thread has a more elegant solution:

  1. Stop the application pool you want to copy (otherwise you’ll get “copy : Object reference not set to an instance of an object”–see this StackOverflow article).
  2. Start PowerShell
  3. import-module webadministration
  4. copy IIS:\AppPools\oldpool IIS:\AppPools\newpool –force
  5. Restart the source application pool.

Voila! The new app pool is there, referencing the same identity. Change its other properties as needed, then assign your application to the new app pool.

Updated November 19, 2013 to add steps 1 and 5.

3 thoughts on “Copy an IIS7 Application Pool

  1. Aaron

    Great Tip. Note to anyone trying this, the app pool you are trying to copy must be stopped for this to work.

  2. Rajeev


    I had same scenario and was required a solution.

    This is very helpful.
    Many thanks Mark.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.