Today I was building some simple deployment CMD files for a project and one of them was for creating a site. I used the stsadm createsite command and picked all my parameters that I wanted and hit enter. Below is the command that I used.
stsadm -o createsite -url http://DONGENU:9001/Thinking -owneremail woxing615@163.com -ownerlogin wudongenu/administrator -lcid 1033 -sitetemplate SPSPORTAL#0 -title "Thinking"
After a few seconds it came back with the below error message and this definitely caught me by surprise.
Another site already exists at http://DONGENU:9001. Delete this site before attempting to create a new site with the same URL, choose a new URL, or create a new inclusioin at the path you originally specified.
After reading the error message a couple times I knew the first part wasn't true because there was no site at that URL path but then it dawned on me that the second part of the error message was the answer to my problem. The URL that I specified has a "Managed Path" and I forgot to create it before running the createsite command. So, I went out to the online STSADM technical reference guide and found the stsadm addpath command. I opened up the CMD file and add the following line above the createsite command and reran it and everything worked just fine.
stsadm-o addpath -url http://DONGENU/MySite -type wildcardinclusion
I know this wasn't really a hard one but at first when I read the error message it wasn’t making any sense but after ignoring the first part of the error message the second part turned the light on for me.
Last,Below is the command that I used.
stsadm -o createsite -url http://DONGENU:9001/MySite/Thinking -owneremail woxing615@163.com -ownerlogin wudongenu/administrator -lcid 1033 -sitetemplate SPSPORTAL#0 -title "Thinking"
Operation completed successfully.
Cheers