locked
find out users are part of group in AD using powershell script RRS feed

  • Question

  • Hi Exports

    I am using below script to find out users are part of blockciscovpn grup or not but not getting any result .

    Get-ADGroup BlockCiscoVPN -Properties Member | Select-Object -ExpandProperty Member | Get-Content .\users.t
    xt | % {Get-ADUser $_ -Properties name,samaccountname | select name,samccountname}

    Friday, March 27, 2020 2:00 PM

All replies

  • Your code does not am,ke sense.  You cannot pipe that to Get-Content.

    You need to learn basic PowerShell before trying to ask a question in this forum.  We cannot guess at what you are asking because you are not asking a legitimate question.

    The following gets all accounts that are a members of a group.

    Get-ADGroup BlockCiscoVPN | Get--AdGroupMember 

    You need to read the help for each CmdLet that you want to use.  Just guessing based on something you have seen is not useful.


    \_(ツ)_/



    • Edited by jrv Friday, March 27, 2020 2:14 PM
    Friday, March 27, 2020 2:14 PM
  • Piping the results from Get-ADGroup to Get-Content doesn't make sense. Eliminate the Get-Content portion and pipe directly to the "%{Get-ADUser ..." portion.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Friday, March 27, 2020 2:15 PM