How do I load the Exchange Management Shell via Powershell Studio 2015 (Remote Session)?

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 8 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
vanhalo
Posts: 2
Last visit: Thu Dec 08, 2016 8:57 am

How do I load the Exchange Management Shell via Powershell Studio 2015 (Remote Session)?

Post by vanhalo »

How do I load the Exchange Management Shell via Powershell Studio 2015 (Remote Session)?
Last edited by vanhalo on Fri Jan 15, 2016 12:22 pm, edited 1 time in total.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How do I load the Exchange Management Shell via Powershell Studio 2015 (Remote Session)?

Post by jvierra »

I am not aware that there are any "Best Practices"

It is not clear why you ask this. Remotely you have to import the modules. Locally you can d either. It is your choice.

PowerShell Studio says nothing about how to use PowerShell. PSS is just an editor and development tool. PowerShell is the decider in all cases
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How do I load the Exchange Management Shell via Powershell Studio 2015 (Remote Session)?

Post by jvierra »

Yu don't load the shell. Just remote into Exchange.
  1. $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<FQDN of Exchange 2016 Mailbox server>/PowerShell/ -Authentication Kerberos -Credential $UserCredential
  2. Remove-PSSession $Session
User avatar
vanhalo
Posts: 2
Last visit: Thu Dec 08, 2016 8:57 am

Re: How do I load the Exchange Management Shell via Powershell Studio 2015 (Remote Session)?

Post by vanhalo »

jvierra wrote:Yu don't load the shell. Just remote into Exchange.
  1. $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<FQDN of Exchange 2016 Mailbox server>/PowerShell/ -Authentication Kerberos -Credential $UserCredential
  2. Remove-PSSession $Session
What is the purpose of importing the remote cache (CacheExport.zip) in this scenario? AKA Exchange

When I use a SharePoint server (importing the cache file) I can add the remote snapin using only the remote cache configuration.

Example:

Add-PsSnapin Microsoft.SharePoint.Powershell

Get-Command -Module Microsoft.SharePoint.PowerShell | Out-File d:\psscripts\SP2013Commands.txt

It seems to me that importing remote cache (when it comes to dealing with Exchange and the Exchange Shell) is of no use because by using the following:

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://servername/PowerShell/ -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session



I am confined to running this script via a local machine connection as I would without Powershell Studio 2015.

I am new to this so maybe I missing something here.

I would prefer to use the Remote Cache feature for Exchange.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How do I load the Exchange Management Shell via Powershell Studio 2015 (Remote Session)?

Post by jvierra »

Using the cache only gives you the intellisense. If the management tools are not installed locally then you cannot add the snap-in. If they are installed locally then you do not need to import the remote cache.

In a remote session you can either enter the session and type commands or attach to the session and use Invoke. We can import the session and it will mostly appear to be local but objects will behave somewhat differently.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: How do I load the Exchange Management Shell via Powershell Studio 2015 (Remote Session)?

Post by jvierra »

I should note that the way Exchange works is very different from many subsystems.

https://technet.microsoft.com/en-us/lib ... .160).aspx
This topic is 8 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked