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:
- Remote Desktop Users
- WinRMRemoteWMIUsers__
- 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
- This will open up a dialog box. Add the user(s) with Read and Execute permissions then click OK
- Run the command again to ensure the permissions were applied correctlty
Type Set-PSSessionConfiguration -Name Microsoft.PowerShell32 –ShowSecurityDescriptorUI
- This will open up a dialog box. Add the user(s) with Read and Execute permissions then click OK
- 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