locked
Need to get a list of users in a group, and need more that just there name. RRS feed

  • Question

  • I am new to powershell and have a couple of scripts that are working but can't get this to function. I need to have a list of users in a specific group and need info about the users. " Title, Department, Manager, LastLogon " I tried this but its not working. Any ideas?

    Get-ADGroupMember "******" -Filter * -Properties * | select SamAccountName, Name, Enabled, Title, Department, @{label='Manager';expression={$_.manager -replace '^CN=|,.*$'}}, LastLogonDate, AccountExpirationDate | Export-CSV "C:\Users\******\Documents\PowerShellOutput\******.CSV"

    Wednesday, January 31, 2018 2:35 PM

Answers

All replies

  • Help Get-ADGroupMember -Parameter *
    There is no 'Filter' or 'Properties' for this Cmdlet. Your command should work without them if you specified proper group name/identity

    -KT

    Wednesday, January 31, 2018 3:04 PM
  • Hi MattA94,

    Are you receiving any errors when you running the script? Wich information do you exactly want to get?


    Sincerely, Martien van Dijk. Please remember to mark the replies as answers if they help and unmark them if they provide no help. Check out My Blog!

    Wednesday, January 31, 2018 3:05 PM
  • Hi MattA94,

    Below is the link of a script. Kindly download and check if you are able to get all the details or not.

    https://gallery.technet.microsoft.com/List-all-users-of-a-AD-10968337/file/187593/1/ListADGroup.ps1



    Regards Udit

    • Proposed as answer by Udit Daga Wednesday, January 31, 2018 3:15 PM
    Wednesday, January 31, 2018 3:05 PM
  • When something like this isn't working, you need to break it down into its smaller component and isolate the problem. If you had done that, you would have immediately seen there is no -properties parameter on the get-adgroupmember cmdlet. You're only hurting yourself by trying to using expressions with your select statement or export to CSV before you've even got the basics working.

    Also, many of the properties you want are returned by default with get-aduser. You only have to add the extra ones you want, like this:

    Get-ADGroupMember 'domain users' | Get-ADUser -Properties title, department, manager, lastlogondate, accountexpirationdate


    Mike Crowley | MVP
    My Blog -- Baseline Technologies


    • Proposed as answer by Mike Crowley Wednesday, January 31, 2018 3:09 PM
    • Edited by Mike Crowley Wednesday, January 31, 2018 3:11 PM
    Wednesday, January 31, 2018 3:08 PM
  • Thanks for pointing that out. I kept seeing my mistake. Should have started simple. Thanks for the help.
    Wednesday, January 31, 2018 3:41 PM
  • Hi,

    I'm checking how the issue is going, was your issue resolved?

    And if the replies as above are helpful, we would appreciate you to mark them as answers, and if you resolve it using your own solution, please share your experience and solution here. It will be greatly helpful to others who have the same question.

    Appreciate for your feedback.

    Best Regards,
    Albert

    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, February 1, 2018 6:30 AM
  • You can use this Powershell command

    Get-QADGroupMember 'GroupName'
    Please refer to the following article.


    https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/ee617193(v=technet.10)
    ________________________________________________________________
    Solution for auditing, it security and compliance.

    Please read the full request and then review the current answers.  Look at what you posted (not a PowerSHell command) and read the link you posted.

    Do you see the issues?


    \_(ツ)_/

    • Marked as answer by Shivkumar S Thursday, February 1, 2018 11:38 AM
    Thursday, February 1, 2018 6:55 AM