Powershell - Removedistributiongroupmember inconsistent behavior
I am experiencing inconsistent behavior with the RemoveDistributionGroupMember cmdlet.
If I run the following PS command in my Win 7 workstation PS command-line:
Get-DistributionGroupMember <groupname> | Remove-DistributionGroupMember <groupname> -Confirm:$false
The command runs fine and every member of the given group is removed.
If I run the same command within a .PS1 file running on the CAS server, I get the following error for every group member that is piped to the Remove-DistributionGroupMember command:
====
The input object cannot be bound to any parameters for the command etiher because the command does not take pipeline input or the input ans it's properties do not match any of the parameters that take pipeline input.
+ Catgegory info: InvalidArgument: (domain/OU/user:PSObject) [Remove-DistributionGroupMember], ParametersBindingException
+FullyQualifiedErrorId: InputObjectNotBound, Remove-DistributionGroupMember
===
I cannot explain why this works perfectly on my Win 7 desktop PS Session and not on the CAS server.
Thanks in advance
Michel Dube
Michel Dub IT analyst (servers) - UQAR
August 17th, 2012 10:41am
Yes, please run Rich posted command to have a try.
Remove-DistributionGroupMember -identity <groupname> -Confirm:$false
If you get any error, please paste in your next post.
Thanks,
EvanEvan Liu
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2012 9:31am
Any updates on this issue?
Thanks,
EvanEvan Liu
TechNet Community Support
August 22nd, 2012 6:22am
We are running Exchange 2010 SP1 UR6 on every server. Now I get the error message everywhere (on the server and the workstation), so I cannot call the behavior inconsistent anymore.
I got around the problem in my script by looping through each object with a foreach loop.
As for the suggestion, it's pretty much the same command I was already trying so I got the same result.
Thanks for the help.Michel Dub IT analyst (servers) - UQAR
Free Windows Admin Tool Kit Click here and download it now
September 4th, 2012 10:49am
Use this command and post the result:
Get-DistributionGroupMember <groupname> | Remove-DistributionGroupMember <groupname> -Confirm:$false -verbose
Thanks,
EvanEvan Liu
TechNet Community Support
September 5th, 2012 6:37am
On Tue, 4 Sep 2012 14:49:09 +0000, TheShape1 wrote:
>
>
>We are running Exchange 2010 SP1 UR6 on every server. Now I get the error message everywhere (on the server and the workstation), so I cannot call the behavior inconsistent anymore.
>
>I got around the problem in my script by looping through each object with a foreach loop.
>
>As for the suggestion, it's pretty much the same command I was already trying so I got the same result.
So by explicity using the -Member parameter in the
Remove-DistributioGroupMember cmdlet it works?
If it's any help you're not the only person to encounter this problem:
http://stackoverflow.com/questions/10624069/remove-distributiongroupmember-specify-a-unique-user
Have you tried updating Exchange to SP2 UR4? The command pipeline you
posted works as intended for me -- but I'm not running SP1 UR6.
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
September 5th, 2012 11:52am