Queries while migrating to EXO v3

Copper Contributor

We are in the process of migrating from EXO v1(secure app model authentication) to v3 REST-based cmdlets. Thanks to the detailed documentation we are able to connect and run cmdlets, using unattended scripting in delegated scenarios.

However we are facing below issues. Could anyone please help us in migration by answering below questions. Thank you in advance.

- How to switch between multiple connected sessions(Each session is of a different organisation)? Is it by importing module from tmp folder or is there any other way to do it?

- How can we disconnect selected connections, as Disconnect-ExchangeOnline does not have any parameters for selecting connections.

- Each session created through Connect-ExchangeOnline is creating a folder in tmp directory with 26MB size. In that help files(*-Help.xml) are of 23MB, is there a way avoid these files in created module under tmp folder.

- In EXO v1, we have used Invoke-Command with PSSession object and -AsJob parameter as mentioned in the documentation . What is the recommended way to do this in v3?

4 Replies
Why do you need multiple sessions in the same console window? It's quite bad experience, because there's a known memory issue. If for some reason you must do it, use a prefix to reference the different sessions ( -Prefix parameter when creating a session). And no, you cannot disconnect a single one.

To avoid downloading the tmp files, use the -SkipLoadingFormatData switch. Or even better, use -CommandName to load just the cmdlets you need.

You cannot use Invoke-Command anymore, as there are no actual Remote PS sessions created. It's all HTTPS now, all cmdlets proxied via single endpoint.

 Thank you for responding.

@Vasil Michev wrote:
Why do you need multiple sessions in the same console window?

I need to connect to multiple organisations(upto 50 accounts) and run cmdlets, So each session is for different organisation. In EXO v1, we used to cache the output of new-PSSession command and with Import-PSSession command we can switch to a different session. Looking for similar thing in EXO v3. Cannot use -prefix as i want to execute the same command in all organisations.


@Vasil Michev wrote:
To avoid downloading the tmp files, use the -SkipLoadingFormatData switch. Or even better, use -CommandName to load just the cmdlets you need.

Not much improvement. With the cmdlets we are using currently size came down from 26 MB to 21 MB. However without *-Help.xml files size came down to 3MB. So looking for a way to avoid these files.


@Vasil Michev wrote:

You cannot use Invoke-Command anymore, as there are no actual Remote PS sessions created. It's all HTTPS now, all cmdlets proxied via single endpoint.

As we needed to run multiple commands(15-20 per organisation) for better performance, in EXO v1 with invoke-command, we used to submit background job for each command and with Get-Job & Receive-Job we used to get the results once the job is completed. With this we don't have to wait for the result. So, Is there any way to create background job in EXO v3?

Can you explain bit more about "it's all HTTPS now, all cmdlets proxied via single endpoint."

Got reply from microsoft team. They are very helpful.

 

posting the answers here.

Q: How to switch between multiple connected sessions(Each session is of a different organisation)? Is it by importing module from tmp folder or is there any other way to do it?

 

A: By using prefix keyword.

 

Q:  How can we disconnect selected connections, as Disconnect-ExchangeOnline does not have any parameters for selecting connections.

 

A: Not possible now, they are working on it.

 

Q: Each session created through Connect-ExchangeOnline is creating a folder in tmp directory with 26MB size. In that help files(*-Help.xml) are of 23MB, is there a way avoid these files in created module under tmp folder.

 

A: No way to avoid this after creating connection help files(*-Help.xml) can be removed.

 

Q: In EXO v1, we have used Invoke-Command with PSSession object and -AsJob parameter as mentioned in the documentation . What is the recommended way to do this in v3?

 

A: In EXO v3, we cannot run as background jobs.

@RahulParshi you can use The SkipLoadingCmdletHelp switch avoids downloading the cmdlet help files(*-Help.xml) with EXO v3.3 onwards. Please go through below article 

https://github.com/MicrosoftDocs/office-docs-powershell/blob/main/exchange/exchange-ps/exchange/Conn...