Assistance with script

Welcome Forums General PowerShell Q&A Assistance with script

Viewing 2 reply threads
  • Author
    Posts
    • #266543
      Participant
      Topics: 2
      Replies: 1
      Points: 31
      Rank: Member

      First I would like to say that I am new to PowerShell, but I am learning and trying.

      I’m trying to run the following script:

      And I am getting the following error:

      Cannot process argument transformation on parameter ‘Member’. Cannot convert the “Lisa Bringel” value of type “Deserialized.Microsoft.Exchange.Data.Directory.Management.ReducedRecipient” to type
      “Microsoft.Exchange.Configuration.Tasks.GeneralRecipientIdParameter”.
      + CategoryInfo : InvalidData: (:) [Remove-DistributionGroupMember], ParameterBindin…mationException
      + FullyQualifiedErrorId : ParameterArgumentTransformationError,Remove-DistributionGroupMember
      + PSComputerName : outlook.office365.com

      I am unsure what I’m doing wrong. Any assistance is appreciated.

    • #266558
      Participant
      Topics: 5
      Replies: 170
      Points: 656
      Helping Hand
      Rank: Major Contributor

      I don’t have an exchange environment to test your code, but I think I know what is going on based on the error message and a little research into the data types in question.  The Get-DistributionGroupMember cmdlet returns “ReducedRecipient” type objects.  After running line 1, $dgm will be an array of those objects.  You can test this by piping the variable to Get-Member and it will tell you what type of objects are contained in the array along with the properties and methods of those objects which is important for the issue you are having because on line 5 you are passing a “ReducedRecipient” type object to the “Member” parameter which expects to receive a “GeneralRecipientIDParameter”.  According to the documentation you can use any value the uniquely identifies the recipient.  Basically you need to find a property of your “ReducedRecipient” object ($user) that does just that.  I think the name property would work, but can’t verify it on my machine, if not I’m sure there is another property that would meet the requirement.

       

    • #266591
      Participant
      Topics: 2
      Replies: 1
      Points: 31
      Rank: Member

      Thank you Mike R., the $user.name worked great.

      I really do want to thank you for taking the time to “teach” so I can continue to learn and move forward. I have posted on other sites and the main response is to get get some training or look in a book. I had searched the “Google’s” and didn’t find a resolution, just more errors. So thank you again for taking the time to help me, and maybe some other newbies, to learn.

      Ochness

Viewing 2 reply threads
  • You must be logged in to reply to this topic.