Set-ApplicationPool

ApplicationPool is a property on the web site in the IIS: drive. Set it like so:

Example

function Set-ApplicationPool([string] $AppPoolName,[string] $ApplicationName)
{ 
    #Add application pool
    Add-ApplicationPool $AppPoolName
  
    #Set application pool  
   .$env:SystemRoot\System32\inetsrv\appcmd.exe set app /app.name:$ApplicationName /applicationPool:$AppPoolName

}

Copy and Try it