executing spsite remotely

I have a sharepoint 2013 server, I can access the get-spsite from the sharepoint powershell management console. I added the Microsoft.sharepoint.powershell into the standard powershell console.
I added the new-psssession to the labsp server labsp
I checked the get-pssnapin -registered to verify Microsoft.sharepoint.powershell module is there. I tried using invoke-command -session with the new-psssession ($session = new-possession -cn labsp) prns only for separation. and I get an error message that get-spsite command is not a cmdlet, function etc…
any suggestions I also tried enter-pssession -cn labsp (which is the sharepoint server. no help-- I can get other cmdlets to excute fine from the remote pssession example invoke-command -session $session -scriptblock { get-process}, but not any relating to get-spxxx cmdlets.

When you create a new session to a remote computer, nothing is loaded by default. So after creating the session, you ALWAYS have to add the snap-in or import the module before you can run commands. The only way to have the SharePoint module (or snap in, I forget which it is) loaded by default in a remote session would be to create a custom remoting endpoint, or to modify the default endpoint.

Create session

$sp = New-PSSession -Computername labsp

tell it to load the snap in

Invoke-Command -Session $sp -ScriptBlock { Add-PSSnapin Microsoft.SharePoint.PowerShell }

run commands

Invoke-Command -Session $sp -ScriptBlock { Whatever }

Thank-You for responding Mr. Jones. After further investigating, attached code
$remoteUsername = “cosdepot\dsfadmin”
$remotePassword = “lab@US24”
$Pass = ConvertTo-SecureString $remotePassword -asPlainText -force
$cred = new-object System.Management.Automation.PSCredential($remoteUserName, $pass)
enter-pssession -cn labsp -Authentication Credssp -Cred $cred
Add-PSSnapin microsoft.sharepoint.powershell
get-pssnapin microsoft.sharepoint.powershell
get-spuser -web “http://labsp/sites/MCS
new-spuser -useralias “tom thumb” -web “http://labsp/sites/MCS
get-spuser -web “http://labsp/sites/MCS
the code fails when I run in total as the sharepoint module did not load. everything after that relates to not being a name of cmdlet so on. The kicker is if I only run up to and including the enter-pssession. wait for the prompt to show connected to remote machine,then add the module sharepoint it loads and the get-pssnapin finds the module (included for troubleshooting only)
and get spuser finds the user base. I tried adding a start-sleep before the adding the snapin, but no help. the same things happens when I try to access the lync server as well (same code base) Any suggestion sir. it almost acts that delay between going into the remote mode (shown by servername being added to the prompt) and the action to add the snapin is to slow. I thought it might be because of the two hop getting to the AD server and back I just don’t know. thanks for your help (its kinda interesting thou)

Are you running that as a script, or typing those commands in manually?

Enter-PSSession isn’t designed to be run in a script that way. In a script, you’d put all of your commands into the -ScriptBlock of Invoke-Command, to send all of the commands to the remote computer.

The double-hop issue can be an issue, but it isn’t causing “command not found.” It’s nothing to do with the delay - your “Add-PSSnapin” command isn’t being sent to the remote computer, because that isn’t how Enter-PSSession works.

Also, ensure you’re meant to be using a snap-in and not Import-Module. I’m not sure which SharePoint uses, is all.

again thank-you for your assistance, for some reason after reading the month of lunches and the powershell in depth, I somehow got the notion that the enter-session was for interactions for one to one and invoke-command was for 1 to many. I only needed to interact with each server for installing the snapin and modules to in the overall scheme of things of create a user, enable that user in lync and sharepoint. I have attached the code I modified per your great remmendation. the first part of the protoype is working. I am waiting for my company to purchase the powershell studio so I can build a GUI to attach. I plan on making each a function I can call from the GUI. one other quick QUESTION is there a line continuation character do I could clean up some of the formatting. thanks again very much.
$remoteUsername = “cosdepot\dsfadmin”
$remotePassword = “lab@US24”
$Pass = ConvertTo-SecureString $remotePassword -asPlainText -force
$cred = new-object System.Management.Automation.PSCredential($remoteUserName, $pass)
$activeD = “labdc4”
$remoteFE= “lablync”
$remoteSP = “labsp”
#Enable-wsmancredSSP -role client -delegatecomputer *
#Enable-WSManCredSSP -Role Server

$remoteUsername = “cosdepot\dsfadmin”
$remotePassword = “lab@US24”
$Pass = ConvertTo-SecureString $remotePassword -asPlainText -force
$cred = new-object System.Management.Automation.PSCredential($remoteUserName, $pass)
invoke-command -cn labdc4 -ScriptBlock {
new-aduser -name “tom thumb” -SamAccountname “tomt” -GivenName “tom” -Surname “thumb” -displayname “tomthumb” -path ‘cn=users, dc=cosdepot,dc=local’ -enabled $true -accountpassword (convertto-secureString -asplaintext “ZAQ!2wsx” -force);
get-aduser tomt}

$remoteUsername = “cosdepot\dsfadmin”
$remotePassword = “lab@US24”
$Pass = ConvertTo-SecureString $remotePassword -asPlainText -force
$cred = new-object System.Management.Automation.PSCredential($remoteUserName, $pass)
invoke-command -cn lablync -Authentication Credssp -Cred $cred -scriptblock {
import-module lync; enable-csuser -identity “tomthumb” -sipaddresstype samaccountname -sipdomain cosdepot.local -registrarpool “pool1.cosdepot.local”;
get-csuser -identity “tomthumb”}

#Enable-wsmancredSSP -role client -delegatecomputer *
#Enable-WSManCredSSP -Role Server

$remoteUsername = “cosdepot\dsfadmin”
$remotePassword = “lab@US24”
$Pass = ConvertTo-SecureString $remotePassword -asPlainText -force
$cred = new-object System.Management.Automation.PSCredential($remoteUserName, $pass)
invoke-command -cn labsp -Authentication Credssp -Cred $cred -ScriptBlock {
Add-PSSnapin microsoft.sharepoint.powershell;
get-pssnapin microsoft.sharepoint.powershell;
get-spuser -web “http://labsp/sites/MCS”;
new-spuser -useralias “tom thumb” -web “http://labsp/sites/MCS”;
get-spuser -web “http://labsp/sites/MCS”}