none
New-SPWeb : Cannot find an SPSite object that contains the following Id or Url: RRS feed

  • Question

  • I have a host header site collection created at:  https://somesite

    I am attempting to run the following command to create a sub site:

    New-SPWeb -URL https://somesite/op -name "Operations" -Template "STS#1"

    This command generates the following error:

    New-SPWeb : Cannot find an SPSite object that contains the following Id or Url:

     

    What am I doing wrong?

    Monday, October 31, 2011 9:26 PM

Answers

  • I just tried this on my dev box and it was successful:

    New-SPWeb -URL http://sp2010dev/op -name "Operations" -Template "STS#1"


    The error message references the SPSite object, so apparently it is not finding the site collection at https://somesite

    What happens if you run these commands?

    $sitecollection = Get-SPSite https://somesite
    $sitecollection


    • Marked as answer by davestech Monday, October 31, 2011 11:12 PM
    Monday, October 31, 2011 9:56 PM

All replies

  • I just tried this on my dev box and it was successful:

    New-SPWeb -URL http://sp2010dev/op -name "Operations" -Template "STS#1"


    The error message references the SPSite object, so apparently it is not finding the site collection at https://somesite

    What happens if you run these commands?

    $sitecollection = Get-SPSite https://somesite
    $sitecollection


    • Marked as answer by davestech Monday, October 31, 2011 11:12 PM
    Monday, October 31, 2011 9:56 PM
  • Get-SPSite failed...turns out I made a mistake with name resolution for the site and I was using the wrong URL (in my host file, this is a test server) which worked when accessing the site collection through the browser but failed from PowerShell.

    thanks for the help...
    Monday, October 31, 2011 11:16 PM