Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to create a site collection via stsadm. I do:

STSADM -o createsite `
    -url "<url>" `
    -title "<title>" `
    -description "<desc>" `
    -lcid 1033 `
    -owneremail "<user email>" `
    -sitetemplate "STS#1" `
    -ownerlogin "<domain\user.name>"

(Sidenote: I'm in Powershell with an alias set up for stsadm.)

When I run the command, at the Powershell prompt I get only the following output:

User cannot be found.

If I look into the ULS logs, I see the following related logs (truncated a bit for clarity):

  • Creating site http://somehost/sites/test in content database WSS_Content_768e4db1bf23493085857cd381b2f72e
  • Error when trying to get trusted forests and domains. Exception message: Current security context is not associated with an Active Directory domain or forest.
  • Found 0 trusted forests .
  • Found 0 trusted domains
  • Error in resolving user '<domain\user.name>' : System.ComponentModel.Win32Exception: Unable to contact the global catalog server

If I create a site collection through Central Administration, using the same <domain\user.name> credentials, the site collection is created fine.

Any ideas as to how to fix this problem? (Just to note, I created a web application via stsadm with the same user credentials and that worked fine.)

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

I wonder if the security context it's referring to is the security context of the script?

I suppose I've got 2 questions:

  1. Are you running the script on the SPT server or remotely?
  2. Does the account you're running under have the rights to create a site?

OK 3 questions... Can you log into SPT with the account you're using in the ownerlogin parameter?

I'm also curious as to why you aliased stsadm? If it's in your path, you should be able to execute it anyway.

share|improve this answer
    
Thanks Mike; to answer your questions: 1. The script is running on the SharePoint server. 2. I'm pretty sure the account has rights -- I'm logged in as local administrator on the machine and 3. when logged in to the account name as in ownerlogin I can create the site collection via Central Admin. As for aliasing stsadm -- I was just blindly following the instructions in this blog post! sharepointblues.com/2010/04/28/scripting-stsadm-with-powershell –  ngm Jun 8 '10 at 8:25
    
The only other security context I can think of is the app pool, if it's running as Network Service, which is a local account. The problem with that is that you're creating sites within Central Admin. What happens if you just use stsadm from the command prompt? As for my statement about Powershell, I really meant it to be a question - I just learned that PSH doesn't care about my system environment variables! –  Mike H Jun 10 '10 at 1:04
    
Just tried from the command prompt (cmd.exe), and got the same 'User cannot be found' error. :-/ –  ngm Jun 10 '10 at 15:06
    
On the server, are you logged into the domain, with a domain account? Or are you logged into a local machine account? Your server will be a domain member but you don't necessarily need to be logged in with a domain account for it to work. –  Mike H Jun 11 '10 at 4:17
1  
OK, finally working! (sort of.) I logged in to the server with a domain account, ran PowerShell with 'Run as Administrator', and then created the site collection with calls to the object model. Not tried it yet, but I imagine the stsadm command would work fine as well, as long as logged in with a domain account with administrator priviledges. –  ngm Jun 11 '10 at 9:11
show 3 more comments

Your Answer

 
discard

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.