Mar 20 2023 01:40 PM
Hello
I had used a code in the past - to disable AD accounts and mailboxes (VB.NET) for terminated users, that I used for years without a problem. Trying to set it up at my new job, however code doesn't work. Tried to connect in Powershell and test it there first - also not working.
Usually I created Runspace (using System.Management.Automation.Runspaces) and used Powershell command "Disable-Mailbox" to disable each mailbox.
I can't even open Runspace - getting error "Connecting to remote server outlook.office365.com failed with the following error message: For more information, see the about_Remote_Troubleshooting Help topic." The account I run it under has remote powershell access.
If I try to use Connect-ExchangeOnline in Powershell itself (able to connect) and try to Disable Mailbox:
Disable-Mailbox -Identity "email address removed for privacy reasons"
- getting error "Write-ErrorMessage : ExE71684|Microsoft.Exchange.Configuration.ObjectModel.ProvisioningValidationException|The following error occurred during
validation in agent 'Archive ParameterSet Enforcement Agent': 'This operation only works with Archive or PermanentlyDisable parameters.'
At C:\Users\suxxxxx\AppData\Local\Temp\tmpEXO_o44bejfi.o2u\tmpEXO_o44bejfi.o2u.psm1:1121 char:13
+ Write-ErrorMessage $ErrorObject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [disable-Mailbox], ProvisioningValidationException
+ FullyQualifiedErrorId : [Server=DM6PR22MB2025,RequestId=58bba87a-90ea-3b76-852c-c15052cd3246,TimeStamp=Mon, 20 Mar 2023 20:32:02 GMT],Write-
ErrorMessage"
Why is this command no longer working? I don't want to permanently disable mailbox, as mailbox might be converted to shared or re-attached later.
Is removing license from mailbox only allowed now by using MsGraph? I'm using Powershell version 5.1 at the moment.
I appreciate your help!
Mar 21 2023 07:11 AM
Mar 21 2023 07:17 AM
@mderooij thank you. So how do I soft delete mailbox (which command)? Which command removes the license?
Mar 21 2023 07:51 AM
Mar 22 2023 11:15 AM