Dec 14 2020
07:09 AM
- last edited on
Feb 01 2023
10:24 AM
by
TechCommunityAP
Dec 14 2020
07:09 AM
- last edited on
Feb 01 2023
10:24 AM
by
TechCommunityAP
Hi All,
I am running one PowerShell script is a long-running script. Initially, it is running successfully after 90 min approx it starts giving an error that cmdlet not recognized. For example below error
get-mailboxstatistics : The term 'get-mailboxstatistics' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At C:\Users\Admin\Desktop\archive.ps1:17 char:17
+ $archivestats = get-mailboxstatistics $mailbox.userprincipalname -arc ...
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (get-mailboxstatistics:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Dec 14 2020 09:05 AM
That's a standard issue with session disconnect. Plenty of articles/threads on how to optimize code to account for this are available online, for example this blog: https://techcommunity.microsoft.com/t5/exchange-team-blog/running-powershell-cmdlets-for-large-numbe...
Feb 18 2021 05:40 AM
How is it that before I was able to run such scripts against Office 365 and now I can't anymore?
I can't seem to be able to accommodate the script wrapper into my script.
Not to mention the fact that the session doesn't actually become broken, somehow it remains opened but no EXO cmdlets available anymore.