Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

How to exclude Group members and its sub group members of a group in powershell?

$
0
0

Hi All,

I would like to export all users from my domain except the members of particular group members and its sub group members. Below is the script I used, but It worked for the primary group but it dinot worked for sub groups .

Get-ADUser -Filter * -Properties memberof | ? {(($_.memberof | Out-String) -notmatch 'ServiceAccounts')} | Select-Object -Property samaccountname

Please Help


Thanks, Sunil Gupta Sunilgupta@sunilgupta.com




Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>