Copy an IIS7 Application Pool

Mark Berry June 14, 2011

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.



2 Comments

  1. Aaron   |  February 15, 2012 at 8:44 am

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

  2. Rajeev   |  October 04, 2015 at 9:45 pm

    Hi

    I had same scenario and was required a solution.

    This is very helpful.
    Many thanks Mark.

Leave a Reply





*