I have started a script that finds all user accounts that are service accounts (their password never expire):
$CorpSvcAccts = Get-ADUser -filter * -Properties PasswordNeverExpires | select name,PasswordNeverExpires,MemberOf | Where-Object {$_.PasswordNeverExpires -like "True"} foreach ($SvcAccts in $CorpSvcAccts) { select memberOf -ExpandProperty memberOf $_. ?? }
…but wish to THEN discover if they are part of a Group called ServiceAccts. I want to export those results. Maybe one column that shows the User account that are TRUE (have membership) and another column that shows FALSE.
I basically want to see each of the user accounts that have pwd set to never expire and if they’re in the Security Group or not, exported.
Thank you