SharePoint Managment Shell via remote session

You can run a SharePoint Management Shell remotely with the following lines of powershell

$Remotesession = New-PSSession -computername "MY_SPServer_Name_Goes_Here" -Authentication CredSSP -Credential $crd

Invoke-Command -Session $Remotesession -ScriptBlock{Add-PsSnapin Microsoft.SharePoint.PowerShell}

 

 

Note, that at this point, you can run whatever administrative PowerShell commands you need to run by using the Invoke-Command -Session $session -ScriptBlock{} syntax.

e.g.

Invoke-Command -Session $Remotesession -ScriptBlock{(get-spfarm).buildversion}

 

If you get any errors when attempting to do this, make sure remoting is enabled on the SharePoint server and that you are using an account that has farm admin access and Shell admin access.

Here’s a technet on enabling remote access for server management.

https://msdn.microsoft.com/en-us/library/dd759202.aspx#BKMK_ps