advserver
asked on
Remove All Members from Distribution Group using PowerShell
Is there a way using the "Remove-DistributionGroupM ember" command to remove all members from a distribution group instead of having to type in each member?
ASKER
The error I received after trying -Member * is listed below. Thank you for your quick response! Any other suggestions are greatly appreciated.
Remove-DistributionGroupMe mber : There are multiple recipients matching the ide
ntity "*". Please specify a unique value.
At C:\Documents and Settings\--\Desktop\remove dg.ps1:1 char:31
+ remove-distributiongroupme mber <<<< -identity "dg72" -member *
Remove-DistributionGroupMe
ntity "*". Please specify a unique value.
At C:\Documents and Settings\--\Desktop\remove
+ remove-distributiongroupme
Apparently that cmdlet only allows for the removal of a unique member. Could you instead run Remove-DistributionGroup to delete the group, and then create a new one using New-DistributionGroup?
ASKER
I was trying to avoid doing that but it appears that might have to be the solution. This command will be running on a daily basis. I will try it out and let you know! Once again thanks for your quick response!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Mestha,
That worked! Do you know the proper syntax for the [-Confirm [<SwitchParameter>]] ? I attempted [-Confirm [A]] -Confirm [A] and -Confirm A and all failed.
That worked! Do you know the proper syntax for the [-Confirm [<SwitchParameter>]] ? I attempted [-Confirm [A]] -Confirm [A] and -Confirm A and all failed.
EXPERT CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much for your help! That worked perfectly!
Open in new window