A positional parameter cannot be found that accepts argument

Rising Flight 4,596 Reputation points
2024-11-02T05:09:02.92+00:00

Hi All

i am using the below syntax in exchange online, i am getting error.

Select-Object : A positional parameter cannot be found that accepts argument 'System.Object[]'.

At line:1 char:79

  • | Select DisplayName,title,userprincipalname,Department,Man ...
Get-DistributionGroupMember -Resultsize Unlimited [email protected] | Select DisplayName,title,userprincipalname,Department,Manager,EmployeeID,Office,country,extension attribute01,PrimarySMTPAddress|  Export-csv -path C:\temp\output.csv -NoTypeInformation

Microsoft Exchange Online
Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,357 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,612 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,691 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
2,147 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce Jing-MSFT 6,250 Reputation points Microsoft Vendor
    2024-11-04T06:08:53.8433333+00:00

    Hi,@Rising Flight

    Thanks for posting your question in the Microsoft Q&A forum.

    The error message suggests that there is a problem with the syntax of your Select-Object command. The issue might be with the way you're specifying the properties to select, especially since you have a space in 'extension attribute01'. PowerShell might be interpreting 'extension attribute01' as two separate arguments rather than one property name.

    Here is how you can modify your command:

    Get-DistributionGroupMember -Resultsize Unlimited 
    
    

    Here is my test, the command works fine.

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.