IIS: Updating the App Pool for an Application

This topic contains 3 replies, has 2 voices, and was last updated by  Des Davies 9 months, 3 weeks ago.

  • Author
  • #78202

    Des Davies

    I have been working on a script to map IIS Sites to a different App Pool.

    This works when the object is a Site:

    Set-ItemProperty -Path "IIS:\Sites\Sitename" -Name ApplicationPool -Value "NewPool"

    However, if the object is an Application under a Site, this runs without an error, but the value does not change.
    I've tried using a "Set-Item" on the Application object, but that errors out.

    Any ideas?


  • #78210

    Curtis Smith

    use the appcmd command

    appcmd set app /app.name: string /applicationPool: string


  • #78219

    Curtis Smith

    I have also seen on other sites where it is stated that "applicationPool" appears to be case sensitive.

    so instead of doing

    Set-ItemProperty -Path "IIS:\Sites\Sitename\app" -Name ApplicationPool -Value "NewPool"


    Set-ItemProperty -Path "IIS:\Sites\Sitename\app" -Name applicationPool -Value "NewPool"
  • #78346

    Des Davies

    Thanks for the help Curtis. The second option, changing he case, doesn't appear to work.

    The appcmd option works. However, I have run in to a problem with it – it requires the powershell session to be run as administrator.

    Any suggestions how I can do that using a remote Invoke-Command?

You must be logged in to reply to this topic.