FIX: PowerShell Remoting fails

Scenario:
Your attempt to remote using PowerShell fails with this message:
Cannot access the local farm. Verify that the local farm is properly configured, currently available, and that you have the appropriate permissions to access the database before trying again.

Fix:
1. On the remote machine run the following PowerShell script:

#Enable Windows PowerShell Remoting 
Enable-PSRemoting -Force 
#Enable CredSSP support 
Enable-WSManCredSSP -Role Server -Force 
#Increase memory limit for remote shell 
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1000

2. On the client machine run the following PowerShell script:
#enable CredSSP on the client:  
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/*

Props:
Josh Gavant: PowerShell Remoting for SharePoint

Leave a Reply