I can create a new web application extension using New-SPWebApplicationExtension but if it already exist I get an error with the message "The IIS Web Site you have selected is in use by SharePoint. You must select another port or hostname.".

I tried using Get-SPWebApplication but it does not return the extensions. I know I could catch the thrown exception and react on it but I wonder if there is a more cleaver way, e.g. Get-SPWebApplicationExtension that I can use to check if it already exist?

1 Answer 1


You have to use the Get-SPAlternateURL, it will return url from all zone then you will be know if one you are requesting being used or not

The Get-SPAlternateURL cmdlet returns all alternate URLs that match the scope given by either the optional Identity parameter or by a combination of the optional WebApplication, Zone, or Resource parameters. Each criterion that is added narrows the scope. If no criteria are specified then all alternate URLs are returned.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.