Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating Site Collections for Testing SharePoint. I am using Host Named Site Collection to do that instead of the path based site collection addressing.

For that

  1. Got a reference to the HNSC web application which I created before using web application management.

  2. created a non-templated site at the root of the web applications for workflow to connect.

    New-SPSite -Name "Root HNSC Site Collection" -Url "http://vspserver -HostHeaderWebApplication $hnscWebApp -OwnerAlias "vspserver \Administrator"
  3. but when I try to create a Team site by using the following scrpit:

    New-SPSite -Name "VSPServer Intranet" -Url "http://intranet.vspserver" –HostHeaderWebApplication $hnscWebApp -Template "STS#0" -OwnerAlias "vspserver\Administrator"

I get this error message:

New-SPSite : Cannot find an SPWebApplication object that contains the
following Name, Id, or Url: http://intranet.vspserver.test-lab.local.
At line:1 char:1
+ New-SPSite -Name "SPServer Intranet" -Url
"http://intranet.vspserver.test-lab.lo ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...SPCmdletNewSite:
   SPCmdletNewSite) [New-SPSite], SPCmdletPipeBindException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite

Any idea would be appreciated.

share|improve this question

You need to create a web app (SPWebApplication) that matches that subdomain first, and you need to refer to the new site collection with it's full FQDN, i.e.


intranet.vspserver is not a FQDN, so it can't be used in a URL.

share|improve this answer
I first created a web app called vspserver according to – user1847609 Dec 12 '12 at 11:58
then I am about to create a team site. So do I need to create a web app for each team site? – user1847609 Dec 12 '12 at 11:59
You want your new site collection to be accessible from a subdomain, i.e. http://intranet.vspserver.test-lab.local. This is called a Host-Named Site Collection. This requires an additional web app. The alternative would be to create a path-based site collection, i.e. http://intranet.vspserver.test-lab.local/intranet. If you named it that, you could reuse your existing web app. – 1.618 Dec 12 '12 at 13:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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