One of the nice features of an Import-PSSession is Prefix parameter. If you have never used one let me try to show you an example that should clear things up for you. Let's assume You want to get mailbox from Office 365 and Exchange On-Premises during the same session. Usually, you would do something like
While this code would most likely work it's pretty inefficient and in more complicated scenarios not really useful. That's why Import-PSSession has a parameter called Prefix. This gives you a way to connect to Office 365 and Exchange Online at the same time!
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -Prefix O365
# Get-Mailbox from Exchange On-Premises
Get-Mailbox -Identity 'MyMailbox1'
# Get-Mailbox from Exchange Online
Get-O365Mailbox -Identity 'MyMailbox2'
Isn't that cool? It is. But this is pretty common so there's probably 50 pages with information on how to use this. What I actually wanted to write about is the ability to dynamically define that prefix for a command.