IIS: Updating the App Pool for an Application

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

  • Author
    Posts
  • #78202

    Des Davies
    Participant

    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?

    Thanks,
    Des

  • #78210

    Curtis Smith
    Participant

    use the appcmd command

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

    https://technet.microsoft.com/en-us/library/cc731755(v=ws.10).aspx

  • #78219

    Curtis Smith
    Participant

    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"

    do

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

    Des Davies
    Participant

    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.