5

I am using Remote PowerShell Session to create SharePoint Site. The client computer is not part of AD forest.

I have used the following PowerShell commands to enter into the remote session.

$cred = Get-Credential $session = New-PSSession -ComputerName "SPServerName" -Credential $cred Enter-PSSession $session Add-PSSnapin Microsoft.SharePoint.PowerShell 

and following commands to create SharePoint Site

$w = Get-SPWebApplication http://SPServerName:8000/ New-SPSite http://sp.test.com -OwnerAlias "ad\spuser" -HostHeaderWebApplication $w -Name "Test Site" 

And I am getting the following error

New-SPSite : User cannot be found. At line:1 char:1 + New-SPSite http://sp.test.com -OwnerAlias "ad\spuser" -HostH ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletNewSite:SPCmdletNewSite) [New-SPSite], SPException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite

However, I am able to create SharePoint Site successfully from within SharePoint server using same PowerShell commands.

1

1 Answer 1

2

You can follow below article to configure remote PowerShell on SharePoint Server. https://blogs.technet.microsoft.com/anneste/2014/09/17/how-to-enable-remote-powershell-for-sharepoint-2013-for-non-administrators/

Since you are doing remote PowerShell you need to make sure PowerShell Process is running under SharePoint Farm Admin or SharePoint Managed Account.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.