Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error caused a change in the current set of domain controllers #9

Closed
Bowerz opened this issue Mar 3, 2022 · 2 comments
Closed

Comments

@Bowerz
Copy link

Bowerz commented Mar 3, 2022

Hi there,

Thanks a lot for this script, it appears to be exactly what I was looking for and very useful.

I have a small question in that i seem to produce the below error quite a lot when running this. Is this expected and can it be mitigated?

Error on proxy command 'Get-MailboxFolderStatistics -FolderScope:'Calendar' -Identity:'[email protected]'' to server xxxxxxxx.eurprd02.prod.outlook.com: Server version 
15.20.5038.0000, Proxy method PSWS: 
Cmdlet error with following error message:
Microsoft.Exchange.Data.Directory.ADServerSettingsChangedException: An error caused a change in the current set of domain controllers.. 
[Server=xxxxxxxxxxxx,RequestId=xxxxx-xxxxx-xxx-xxxxxx-578b2967c56c,TimeStamp=03/03/2022 09:38:50] .
    + CategoryInfo          : NotSpecified: (:) [Get-MailboxFolderStatistics], CmdletProxyException
    + FullyQualifiedErrorId : [Server=xxxxxxxx,RequestId=xxxxxx-xxxxx-xxxxx-xxxxxxx-578b2967c56c,TimeStamp=03/03/2022 09:38:50] [FailureCategory=Cmdlet-CmdletProxyException] 9E701B98,Microsoft.Exchange.Management.Tasks.GetMailboxFolderStatistics
    + PSComputerName        : outlook.office365.com
 
You cannot call a method on a null-valued expression.
At C:\Users\user\Documents\PowerShell Scripts\Calendar share externally.ps1:76 char:9
+         $calendarfolder = (Get-MailboxFolderStatistics $MB.PrimarySmt ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
@michevnew
Copy link
Owner

That's more or less a standard issue with running Remote PowerShell against Exchange Online, as servers are regularly taken out of rotation. Not much you can do about it, but try again. I will update the script to use the new, more "robust" REST-based cmdlets when I get some time, as using them should improve the stability.
As a quick fix you can just try replacing them yourself, Get-Mailbox <> Get-EXOMailbox, Get-MailboxStatistics <> Get-EXOMailboxStatistics and so on.

@Bowerz
Copy link
Author

Bowerz commented Mar 7, 2022

It's interesting you post that, I did try to update your script to use these new cmdlets but they don't appear to be recognised when run in a function. Not sure if you had any luck with it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants