I try to create application pool on the remote computer and if it exists already command fails:
Invoke-Command -ComputerName $ServerName -ScriptBlock {Import-Module WebAdministration;new-WebAppPool $($args[0]) -Force} -ArgumentList $proj
Filename: Error: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'BIB ' + CategoryInfo : InvalidData: (:) [New-WebAppPool], COMException + FullyQualifiedErrorId : Filename: Error: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'BIB ' ,Microsoft.IIs.PowerShell.Provider.NewAppPoolCommand
So, how can I force creating pool if it exists already? Or how can I previously check if it exists?