Thank you for pointing me in the right direction of checking for the AD group.
The AD group i was using had been moved into a sub-OU, causing the issue.
Once i had the correct path to the security group, everything worked as required.
If anyone else needs the full code, it is
# Group Check
$Group = [ADSI]"LDAP://cn=IT Alerts,OU=Groups,OU=domain"
$Group.Member | ForEach-Object {
if ($user.distinguishedname -match $_) {
$ItStaff = $true
}
}
$Group = [ADSI]"LDAP://cn=Human Resources,OU=Groups,OU=domain"
$Group.Member | ForEach-Object {
if ($user.distinguishedname -match $_) {
$HRStaff = $true
}
}
and in the signature generation area
$(if($ITStaff){"IT Helpdesk"+" |"})
$(if($HRStaff){"Human Resources"+" |"})
Thanks again.
Peter Digby