What am I doing wrong here? This doesn’t seem to be working and I can’t seem to figure out why. Thanks all.
Eval Code
$user = ‘DomainNameHere\DomainGroupHere’
$LocalGroup = ‘Administrators’
if ((Get-LocalGroupMember -Group $LocalGroup).Name -contains $user)) {
exit 0
} else { Exit 1 }
Remediation Code
$user = ‘DomainNameHere\DomainGroupHere’
$LocalGroup = ‘Administrators’
Add-LocalGroupMember -Group $LocalGroup -Member $user