running remote commands

Just completed the MVA Powershell class (topic 9) about loading remote powershell commands to your workstation/tablet, etc. Can very easily get ActiveDirectory management to function even with a prefix, but unable to load powershell for Exchange. I know this is a pssnapin so I have to use the add-pssnapin. When I query the Exchange server with “invoke-command -computername exchange2010 {get-pssnapin -registered}” the snapins are returned. If I try to load the snapins like I did with a module (invoke-command -computername exchange2010 {add-pssnapin microsoft.exchange.management.powershell.e2010}) the command seems to run but I do not have any of the Exchange powershell commands. What am I missing?

You are going to want to use a Session for this

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "http://exchange.fqdn/powershell" -Authentication Kerberos

Import-PSSession -Session $Session

When you are done, you can do this to clean up the session connection:

Get-PSSession | Remove-PSSession

Ahh…Was creating a powershell session with the server but not in this way. I was creating the session with the server and trying to use load-pssnapin. Thank for pointing out the correct way.