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:46am

On Fri, 17 Aug 2012 14:41:45 +0000, TheShape1 wrote: > > >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. Does it work if you use "..| Remove-DistributionGroupMember -identity <groupname> -Confirm:$false"? Are you running Exchange 2007? Are the servers and your workstation both running the same SP and Update Rollup of the Exchange Management Tools? --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
August 17th, 2012 10:04pm

On Fri, 17 Aug 2012 14:41:45 +0000, TheShape1 wrote: > > >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. Does it work if you use "..| Remove-DistributionGroupMember -identity <groupname> -Confirm:$false"? Are you running Exchange 2007? Are the servers and your workstation both running the same SP and Update Rollup of the Exchange Management Tools? --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
August 17th, 2012 10:08pm

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:36am

Any updates on this issue? Thanks, EvanEvan Liu TechNet Community Support
August 22nd, 2012 6:28am

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:48am

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:41am

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:56am

Looping through each member with the Remove-DistributionGroupMember works. But it would be simpler and more efficient to simply pipe the results of the Get-DistributionMember into a Remove-DistributionGroupMember command. And that's exactly where my problem is. The following command works perfectly (as it should) when run from the EMS of my workstation: Get-DistributionGroupMember <groupA> -ResultSize unlimited | Remove-DistributionGroupMember <groupA> -Confirm:$false It's when I run the same command on the EMS of the CA server that I get the error message mentioned in my original post. I should note that the EMS session is run under the same credentials on my workstation than the CA server. The verbose switch doesn't give much more info I'm afraid: Here it is on my workstation: ============= VERBOSE: [15:12:28.843 GMT] Remove-DistributionGroupMember : Active Directory session settings for 'Remove-DistributionGroupMember' are: View Entire Forest: 'False', Default Scope: 'bureautique.uqar.qc.ca', Configuration Domain Controller: 'SLDC3.bureautique.uqar.qc.ca', Preferred Global Catalog: 'SLDC3.bureautique.uqar.qc.ca', Preferred Domain Controllers: '{ SLDC3.bureautique.uqar.qc.ca }' VERBOSE: [15:12:28.843 GMT] Remove-DistributionGroupMember : Runspace context: Executing user: bureautique.uqar.qc.ca/Users/Administrateur, Executing user organization: , Current organization: , RBAC-enabled: Enabled. VERBOSE: [15:12:28.843 GMT] Remove-DistributionGroupMember : Beginning processing & VERBOSE: [15:12:28.843 GMT] Remove-DistributionGroupMember : Instantiating handler with index 0 for cmdlet extension agent "Admin Audit Log Agent". VERBOSE: [15:12:28.858 GMT] Remove-DistributionGroupMember : Current ScopeSet is: { Recipient Read Scope: {{, }}, Recipient Write Scopes: {{, }}, Configuration Read Scope: {{, }}, Configuration Write Scope(s): {{, }, }, Exclusive Recipient Scope(s): {}, Exclusive Configuration Scope(s): {} } VERBOSE: [15:12:28.858 GMT] Remove-DistributionGroupMember : Searching objects "personnel-particulier-adm-rimouski" of type "ADGroup" under the root "$null". VERBOSE: [15:12:28.858 GMT] Remove-DistributionGroupMember : Previous operation run on domain controller 'SLDC3.bureautique.uqar.qc.ca'. VERBOSE: [15:12:28.858 GMT] Remove-DistributionGroupMember : Processing object "bureautique.uqar.qc.ca/BUREAUTIQUE/Groupes/GR_Distribution/DISTOF_personnel-particulier-adm-rimouski". VERBOSE: [15:12:28.858 GMT] Remove-DistributionGroupMember : Searching objects "bureautique.uqar.qc.ca/BUREAUTIQUE/USAGERS/Employes/fourmi02" of type "ADRecipient" under the root "$null". VERBOSE: [15:12:28.874 GMT] Remove-DistributionGroupMember : Previous operation run on global catalog server 'SLDC3.bureautique.uqar.qc.ca'. VERBOSE: [15:12:28.874 GMT] Remove-DistributionGroupMember : Admin Audit Log: Entered Handler:Validate. VERBOSE: [15:12:28.874 GMT] Remove-DistributionGroupMember : Admin Audit Log: Exited Handler:Validate. VERBOSE: Removing distribution group member "bureautique.uqar.qc.ca/BUREAUTIQUE/USAGERS/Employes/fourmi02" from distribution group "personnel-particulier-adm-rimouski". VERBOSE: [15:12:28.874 GMT] Remove-DistributionGroupMember : Resolved current organization: . VERBOSE: [15:12:28.874 GMT] Remove-DistributionGroupMember : Saving object "bureautique.uqar.qc.ca/BUREAUTIQUE/Groupes/GR_Distribution/DISTOF_personnel-particulier-adm-rimouski" of type "ADGroup" and state "Changed". VERBOSE: [15:12:28.874 GMT] Remove-DistributionGroupMember : Previous operation run on domain controller 'SLDC3.bureautique.uqar.qc.ca'. VERBOSE: [15:12:28.874 GMT] Remove-DistributionGroupMember : Admin Audit Log: Entered Handler:OnComplete. VERBOSE: [15:12:28.889 GMT] Remove-DistributionGroupMember : Admin Audit Log: Exited Handler:OnComplete. VERBOSE: [15:12:28.889 GMT] Remove-DistributionGroupMember : Ending processing & ====== And then the EXACT SAME command on the CA server (with the error message underlined): ========= VERBOSE: [00:16:25.413 GMT] Remove-DistributionGroupMember : Active Directory session settings for 'Remove-DistributionGroupMember' are: View Entire Forest: 'False', Default Scope: 'bureautique.uqar.qc.ca', Configuration Domain Controller: 'SLDC3.bureautique.uqar.qc.ca', Preferred Global Catalog: 'SLDC3.bureautique.uqar.qc.ca', Preferred Domain Controllers: '{ SLDC3.bureautique.uqar.qc.ca }' VERBOSE: [00:16:25.413 GMT] Remove-DistributionGroupMember : Runspace context: Executing user: bureautique.uqar.qc.ca/Users/Administrateur, Executing user organization: , Current organization: , RBAC-enabled: Enabled. VERBOSE: [00:16:25.413 GMT] Remove-DistributionGroupMember : Beginning processing & VERBOSE: [00:16:25.413 GMT] Remove-DistributionGroupMember : Instantiating handler with index 0 for cmdlet extension agent "Admin Audit Log Agent". The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its prope rties do not match any of the parameters that take pipeline input. + CategoryInfo : InvalidArgument: (bureautique.uqa...ployes/fourmi02:PSObject) [Remove-DistributionGroupMember], ParameterBindingExcept ion + FullyQualifiedErrorId : InputObjectNotBound,Remove-DistributionGroupMember VERBOSE: [00:16:25.413 GMT] Remove-DistributionGroupMember : Ending processing & ======== I cannot explain why it works on my workstation EMS and give this error on my CA server. That's why I had to resort to looping each group member through the Remove-DistributionGroup command. Michel Dub IT analyst (servers) - UQAR
September 11th, 2012 9:27pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics