Copy running IIS App Pool with Powershell WebAdministration Copy running IIS App Pool with Powershell WebAdministration powershell powershell

Copy running IIS App Pool with Powershell WebAdministration


Have you tried using appcmd instead?

Update: try a combination of both -

Maybe add doesn't let you both import and specify commands. You could try something like this:

appcmd list appool thing1 /xml > c:\tempfile.xml(Get-Content c:\tempfile.xml).Replace("thing1", "thing2") | Out-File c:\tempfile2.xmlappcmd add apppool /in < c:\tempfile2.xml

You may have to debug that script a bit :)


To export the application pool use %windir%\system32\inetsrv\appcmd list apppool "AppPoolName" /config /xml > D:\AppPoolConfig.xml

Without the /config you're missing all of the settings within the application pool and when you go to import that you're only going to create a new application pool with default application pool settings.