0

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.

user1847609
  • 145
  • 1
  • 7

1 Answers1

0

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.

http://intranet.vspserver.test-lab.local.

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

1.618
  • 669
  • 1
  • 4
  • 17
  • I first created a web app called vspserver according to http://www.criticalpathtraining.com/Members/Pages/default.aspx – 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