Hi, I experienced the same problem. It occurs when you try to create a website while there are 0 existing websites. As soon as I added a "Default" website the command worked fine. Thanks,
This problem does not occur when using Windows Server 2008 Server-Core, removing all web sites and then creating new ones in a script works fine, using the same script in the full GUI version of Windows fails as described above.
I also got this message back and it is truthfully annoying something. My advice checking whether do you have already existing Web Sites.
(Ctrl+c & Ctrl+v the following code)
Import-Module WebAdministration;$a=Get-Website;If($a -eq $Null){Write-Host "Whether my variable is empty or not?" -ForegroundColor White;Write-Host "Yeah, it's definately a null-valued variable." -ForegroundColor Yellow}Else{Write-Host "Whether my variable is empty or not?" -ForegroundColor White;Write-Host "Nope, There is something in there." -ForegroundColor Green}
If you are getting nothing back it means that you do not have existing site. In this case you must use the -Id parameter and it has to have a valid value. For instance:
If you have already have sites you shouldn't use the -Id parameter because the script will increase the number and this number will be assigned to the newly created site.
AppWorksDev
1 Post
Re: Problem with New-Website
Mar 27, 2012 07:50 PM|LINK
tweenet
3 Posts
Re: Problem with New-Website
May 11, 2012 10:47 AM|LINK
supi007
1 Post
Re: Problem with New-Website
Dec 06, 2012 01:07 PM|LINK
Hi,
I also got this message back and it is truthfully annoying something. My advice checking whether do you have already existing Web Sites.
(Ctrl+c & Ctrl+v the following code)
Import-Module WebAdministration;$a=Get-Website;If($a -eq $Null){Write-Host "Whether my variable is empty or not?" -ForegroundColor White;Write-Host "Yeah, it's definately a null-valued variable." -ForegroundColor Yellow}Else{Write-Host "Whether my variable is empty or not?" -ForegroundColor White;Write-Host "Nope, There is something in there." -ForegroundColor Green}If you are getting nothing back it means that you do not have existing site. In this case you must use the -Id parameter and it has to have a valid value. For instance:
This helped me.
If you have already have sites you shouldn't use the -Id parameter because the script will increase the number and this number will be assigned to the newly created site.
I hope this helps.
Cheers (sry for typos)