To display the mailboxes that are a member of a particular group
$gp = $(Get-Group "GroupName").Identity.DistinguishedName
Get-Mailbox -Filter{(memberofgroup -eq $gp)}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices;
namespace ClearUserCert
{
class Program
{
static void Main(string[] args)
{
DirectoryEntry de = new DirectoryEntry("LDAP://CN=The User,OU=Staff,DC=TheDomain,DC=Local");
de.Properties["userCertificate"].Clear();
de.CommitChanges();
de.Dispose();
}
}
}