Tuesday, June 27, 2017

SharePoint Remote PowerShell

Yes it is possible, Please follow the steps below.

On the client machine (the management server):

  • Enable-WSManCredSSP -Role Client -DelegateComputer * -Force
  • Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowFreshCredentials -Name WSMan -Value WSMAN/*

  • Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowFreshCredentialsDomain -Name WSMan -Value WSMAN/*

On the SharePoint server:

  • Enable-PSRemoting -Force

  • Enable-WSManCredSSP -Role Server -Force

Afterwards it is possible to connect to the server using PowerShell from your management server, using the following cmdlet:

  • Enter-PSSession SPServer -Authentication CredSSP -Credential DOMAIN\username
  • Add the SharePoint PowerShell SnapIn
  • Add-PSSnapIn Microsoft.SharePoint.PowerShell

To see if it works, run a simple SharePoint cmdlet:

Get-SPSite

PowerShell Remoting for SharePoint

Original Ref

https://blogs.msdn.microsoft.com/besidethepoint/2010/05/26/powershell-remoting-for-sharepoint/