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

1 Answer 1


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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.