SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a site collection under a web application on a remote machine using sharepoint powershell's invoke-command as below

$secpasswd = ConvertTo-SecureString "Dummy" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ("super", $secpasswd)

invoke-command -computername ws-41 -scriptblock { C:\Scripts\prod\NewSpSite.ps1 } -Credential $cred 

NewSpSite.ps1 [file on remote machine]

New-SPSite "https://ws-41:21000/" -OwnerAlias "super" -Name "Testsite" -Template "STS#0" -Language 1033 

user "super" is the system admin, farm admin, db-admin still the invoke-command fails with "User cannot be found" exception

User cannot be found.
    + CategoryInfo          : InvalidData: (Microsoft.Share...SPCmdletNewSite:SPCmdletNewSite) [New-SPSite], SPExcepti
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite

whats the reason?

If remotely loggin to ws-41 as "super" and run the New-SpSite.ps1 , then site collection will be created

Regards Jeez

share|improve this question

It doesnt look like you specify a domain for your user. Also if your SharePoint server lives in another domain, make sure that there is trust between the domain where you execute the command and the target server domain. When using PSCredential and Get-Credential also be aware that they do not validate your password or user, so it will not fail if you specify a non-existing user/domain or invalid password.

share|improve this answer
Hi Anders, Thanks for the info. Both the machines are in the same domain. – JeeZ Apr 28 '11 at 10:14
Well the error indicates that it cant find the user. Did you try with domain\super ? – Anders Rask Apr 28 '11 at 11:07
yes it did not work ! – JeeZ Apr 28 '11 at 11:24
also in the New-SPSite command (-OwnerAlias)? – Anders Rask Apr 28 '11 at 11:58
yes, still it did not work :| – JeeZ Apr 29 '11 at 6:07

Your Answer


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.