Enable remote PowerShell for SharePoint 2013

Hi all,

Due to requierements of a project I needed to explain to a customers how to enable remote PowerShell for SharePoint, so I decided to documentated it. In order to run SharePoint PowerShell, the following steps need to be followed:

On the SharePoint Server

Open local groups and add your user to the following groups:

  1. Remote Desktop Users
  2. WinRMRemoteWMIUsers__
  3. WSS_ADMIN_WPG

Open the SharePoint Shell as admin an execute the following: Enable-PSRemoting -Force

Enable-WSManCredSSP -Role Server

winrm set winrm/config/winrs ‘@{MaxShellsPerUser=”25″}’

winrm set winrm/config/winrs ‘@{MaxMemoryPerShellMB=”600″}’ #is it possible to change to a higher value

Get-SPDatabase | Add-SPShellAdmin DOMAINUserName

#to give permission of shell admin to every SharePoint database

Type Get-SPShellAdmin  and The user you added should now be listed

Set-PSSessionConfiguration -Name Microsoft.PowerShell32 –ShowSecurityDescriptorUI

  1. This will open up a dialog box. Add the user(s) with Read and Execute permissions then click OK
  2. Run the command again to ensure the permissions were applied correctlty

Type Set-PSSessionConfiguration -Name Microsoft.PowerShell32 –ShowSecurityDescriptorUI

  1. This will open up a dialog box. Add the user(s) with Read and Execute permissions then click OK
  2. Run the command again to ensure the permissions were applied correctly

On the client Machine

Open PowerShell as Administrator

Enable-WSManCredSSP -Role client -DelegateComputer “SharePointServerName”

In case you receive an error like “Enable-WSManCredSSP : The client cannot connect to the destination specified in the request. Verify that the service on the
destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination
to analyze and configure the WinRM service: “winrm quickconfig”.

Will say that in Windows 7 or Windows 8.1 or Windows 10 your Windows Remote Management service is not started, and also not set in Automatic Startup mode, to set Windows Remote Management Service just run following cmdlets:

Set-Service winrm -StartupType Automatic
get-service winrm | Start-Service

$cred=get-Credential

$s=new-PSsession “SharePointServerName” -authentication credssp -credential $cred

Invoke-Command -Session $s -ScriptBlock {Add-PSSnapin Microsoft.SharePoint.PowerShell;}

And you are ready to go, if you need more info abou the process, you can visit the following post for more info or post in the comments and I will try to help you

https://blogs.technet.microsoft.com/anneste/2014/09/17/how-to-enable-remote-powershell-for-sharepoint-2013-for-non-administrators/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s