A positional parameter cannot be found that accepts argument

Rising Flight 6,096 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 cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
Exchange | Exchange Server | Other
Exchange | Exchange Server | Other
A robust email, calendaring, and collaboration platform developed by Microsoft, designed for enterprise-level communication and data management.Miscellaneous topics that do not fit into specific categories.
Exchange | Exchange Server | Management
Exchange | Exchange Server | Management
The administration and maintenance of Microsoft Exchange Server to ensure secure, reliable, and efficient email and collaboration services across an organization.
Exchange | Hybrid management
Exchange | Hybrid management
The administration of a hybrid deployment that connects on-premises Exchange Server with Exchange Online, enabling seamless integration and centralized control.
{count} votes

Answer accepted by question author
  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' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.