Link to home
Start Free TrialLog in
Avatar of EDIE_IT
EDIE_ITFlag for United States of America

asked on

Office 365 deleting residual distibution groups

I am experiencing a dilemma and hoping one of you may had experience this issue before.

Currently, I notice that there are leftover distribution groups in office 365 after they have been completely deleted from Active Directory. I can see these distribution groups in office 365 admin console.

Dirsync is currently being used in the domain and has been working great, but for whatever reason several distribution groups were not deleted from office 365 when they were deleted from Active Directory.

I have tried to run 'Remove-DistributionGroup' in powershell and I am unsucessful. The following error comes up: The action 'Remove-DistributionGroup', 'Identity', can't be performed on the object '' because the object
is being synchronized from your on-premises organization. This action should be performed on the object in your on-premises organization.


Obviously it does not exist in Active Directory anymore but still exists in office 365. I do not want to disable DirSync in order to delete these ghost distribution groups.

I have administrator rights in office 365 and the domain, I can add / remove permissions, I can change UPN, etc.

I have also tried to delete these ghost distribution groups from the admin console in office 365 and I receive the same error as when I try to delete them with powershell.

Is there a way to disable dirsync for one item only? or is there any other way I might be able to delete these distribution groups which are no longer in use, but still show up in office 365 only?

Thank you, your comments and help are appreciated.
Avatar of Manpreet SIngh Khatra
Manpreet SIngh Khatra
Flag of India image

Avatar of EDIE_IT

ASKER

I tried it and does not work. After all it is a distribution group that one I am trying to get rid off in office 365, not a user. Also, I am not trying to retrieve any deleted users. I tried also 'msol-group' without any success.
Commonly used PowerShell scripts
https://eastridge.zendesk.com/entries/21573608-commonly-used-powershell-scripts

FIRST:  $Cred = Get-Credential
SECOND:  $Session = new-pssession -configurationname microsoft.exchange -connectionuri https://ps.outlook.com/powershell/ -credential $cred -authentication basic -allowredirection
THIRD:  set-executionpolicy remotesigned
FOURTH:     import-pssession $session

I guess you first have to run these commands and then proceed.

- Rancy
Avatar of EDIE_IT

ASKER

Rancy, I do not have a problem connecting to Office365 or Msolonline, I can already execute any command and it works such as changing UPN, adding mailbox permissions, etc. What I am having issues is with these ghost distribution groups which they do not longer exists in AD, but do not want to dissapear from Office 365 Admin Console
Ohk what i was thinking is that Instead of Mailbox\User we can provide DistributionGroup

First run the command and check if you get the information for the DL's you have concerns with
Get-MsolDistributionGroup -ReturnDeletedDistributionGroup

- Rancy
ASKER CERTIFIED SOLUTION
Avatar of EDIE_IT
EDIE_IT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I called Microsoft and they said that the only way to remove these ghost distribution groups, would be to disable DirSync. I did not want to disable it since it takes 72 hours to disable and 24 hours to enable again, this is very incovenient - Agree and also that MS should have something like they have for Mailbox :( Agrrrrr

Disable and Enable is almost 3-4 days and can only be done if you have a Long weekend.

- Rancy
Avatar of EDIE_IT

ASKER

Answered own question.