A positional parameter cannot be found that accepts argument

Rising Flight 5,216 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 ******@contoso.com | Select DisplayName,title,userprincipalname,Department,Manager,EmployeeID,Office,country,extension attribute01,PrimarySMTPAddress|  Export-csv -path C:\temp\output.csv -NoTypeInformation

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
Exchange Exchange Server Other
Exchange Exchange Server Management
Exchange Hybrid management
{count} votes

Accepted answer
  1. Anonymous
    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 additional answers

Sort by: Most helpful

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.