Support Forums

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

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.
User avatar
vanhalo
Posts: 2
Joined: Thu Jan 07, 2016 10:07 am

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

Postby vanhalo » Fri Jan 15, 2016 9:27 am

How do I load the Exchange Management Shell via Powershell Studio 2015 (Remote Session)?
Last edited by vanhalo on Fri Jan 15, 2016 1:22 pm, edited 1 time in total.
User avatar
jvierra
Posts: 10043
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Sat Jan 16, 2016 8:29 pm

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
User avatar
jvierra
Posts: 10043
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Sat Jan 16, 2016 8:32 pm

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

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

Postby vanhalo » Thu Feb 04, 2016 7:22 am

jvierra wrote:Yu don't load the shell. Just remote into Exchange.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<FQDN of Exchange 2016 Mailbox server>/PowerShell/ -Authentication Kerberos -Credential $UserCredential
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.
User avatar
jvierra
Posts: 10043
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Thu Feb 04, 2016 7:28 am

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.
User avatar
jvierra
Posts: 10043
Joined: Tue May 22, 2007 9:57 am
Contact:

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

Postby jvierra » Thu Feb 04, 2016 7:34 am

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

https://technet.microsoft.com/en-us/library/dd335083(v=exchg.160).aspx

Return to “Windows PowerShell”

Who is online

Users browsing this forum: No registered users and 6 guests