Implicit Remoting for SharePoint 2013

I need to be able to use implicit remoting to a SharePoint 2013 server. Using the information in the article below I have set it up and am trying to import the session, but am getting the following error:

import-pssession: Running the get-Command command in a remote session returned no results.

Not sure if it makes a difference, but the psversion on the server is 3 and the psversion on the client machine is 5.

https://www.globalknowledge.com/blog/2015/12/02/how-to-manage-powershell-remote-access-with-sharepoint-server-2013/

Any suggestions are welcome

 

That’s a known problem with SP2013. Implicit Remoting doesn’t work with it very well. There are authentication problems, as well as what you’re running into. “Don’t use SP2013” is the most common answer I see. I mean… it is pushing 6 years old.

Yep on get off SP2K13, but we know how many enterprises are, meaning slow to move for whatever the reason. I still have to deal with this at many customers I get called to engage with. Legacy everything, but they want to do all this new stuff. Argh!!!

You do not say how you PSRemoting environment is setup. SP requires extra steps to do this.

Understand the security ramifications of some remote session types, and specifically SharePoint.

https://powershellmagazine.com/2014/03/06/accidental-sabotage-beware-of-credssp https://blogs.technet.microsoft.com/heyscriptingguy/2012/11/14/enable-powershell-second-hop-functionality-with-credssp https://msdn.microsoft.com/en-us/library/ee309365(v=vs.85).aspx https://blogs.msdn.microsoft.com/besidethepoint/2010/05/26/powershell-remoting-for-sharepoint

MS TechNet has had this documented for over 4 years now.

How to enable Remote PowerShell for SharePoint 2013 for Non-Administrators

See also:

https://thesharepointfarm.com/2013/04/powershell-remoting-to-a-sharepoint-server-with-powershell-v3-installed

Once you get all setup as required…
(In all my use cases to date, I just had to do this - the below has not worked in all scenarios)

# On the SharePoint Server
Enable-PSRemoting -Force Enable-WSManCredSSP -Role Server -Force
Enable-WSManCredSSP -Role Server -Force


# On your management 
# Client (this has to be done once per unique managment 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/*

you should be able to do this. Well, I have, and it’s worked in my use cases as needed.

SharePointSession = New-PSSession -ComputerName SharePointServerFqdn `
-Authentication Credssp -Credential ResourceAdministrator
Invoke-Command -Session SharePointSession `
-scriptblock {Add-PsSnapin Microsoft.SharePoint.PowerShell}
Import-PSSession SharePointSession