In a brief “lapse” from the “Intro to PowerShell” sections I wanted to outline some important background for those of you anxious to run your SharePoint administration commands from a remote console. Keep in mind that just running Enable-PSRemoting is not enough! There are a few unique requirements that the SharePoint environment adds to running remote commands:
1. You MUST use CredSSP authentication. Any command that talks to a SharePoint cmdlets that itself talks to SQL (which is most commands) will need to call SQL “as you”. This means you need the ability to “double hop”—which CredSSP provides. This is enabled using the “Enable-WSmanCredSSP” cmdlets. (if you don’t use this you’ll most likely see a message saying the farm does not exist or you do not have enough privledges).
2. You SHOULD increase the MaxMemoryPerShellMB value on the remote boxes which essentially limits the amount of memory that any single remote process can use. I would not recommend doing this on every box—but rather an “admin machine” that is not externally available. The default value is 150MB, which will often fail for Site Collection creation and other long-running commands. You can change this value to a larger value (in this example 1000) using the Set-Item cmdlet:
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1000
You may hit other “WSman” specific configuration issues along the way—they are often specific to your domain. However, these error messages are usually quite detailed and I have found over time to always include enough information to solve the problem right away.