Forum Discussion
Microsoft Teams Report extracting owner email address
Himanshu Singh, You can check for the PSsession status before you get the owners every iteration.
$PSSessionStatus = $(Get-PSSession -Name $Session.Name ).State
If($PSSessionStatus -eq Opened)
{
Run the code to obtain de owners
}
Else
{
#Create a new session and run the code to obtain the owners
}
As an alternative, you can create a counter that increments every time you iterate inside the loop and every N number of iterations you close and reopen the PSsession (Refreshing it).
Also to reduce loading times I will recommend only import the cmdlets that you are using.
Import-PSSession $Session -AllowClobber -Verbose -CommandName "Get-UnifiedGroupLinks"
Regards
Erick A. Moreno
I just found out this one
Use the Exchange Online PowerShell V2 module
https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/exchange-online-powershell-v2/exchange-online-powershell-v2?view=exchange-ps#how-the-exo-v2-module-works
How the EXO V2 module works
The Exchange Online PowerShell V2 module contains a small set of new cmdlets that are optimized for bulk data retrieval scenarios (think: thousands and thousands of objects).
I will also try the suggestions you have mentioned,
could you please share how to add so that it continues to show progress status all through...
BR,
/HS
- Himanshu SinghApr 19, 2020Iron Contributor
Hi,
I just finished using the Connect-ExchangeOnline - it only generates ~400 groups whereas i know i have more then 10K appears it is not showing the Archived ones may be,
I have MFA enabled i - storing creds in a variable doesnt help ??
BR,
/HS