In the AD, there is a list of groups such as:
- ServerDEV_4283V
- ServerDEV_4221C
- ServerDEV_9080M
- ServerDEV_2722W
....
I am able to get one specific group but I can't get a list of groups with starting with ServerDEV_4.
Here is my code block:
DirectoryEntry entry = new DirectoryEntry("LDAP://YourServer/OU=SubOU,OU=TopLevelOU,dc=test,dc=com", userName, password,AuthenticationTypes.Secure);
try
{
DirectoryEntry childGroup = entry.Children.Find("CN=ServerDEV-4283V");
// create group here
}
catch (DirectoryServicesCOMException exception)
{
// handle the "child not found" case here ...
}
Is there a way I could do the RegEx like "ServerDEV-4" so I can get 2 top groups?
Appreciate your help.
Thanks
It turned out the wildcard would be enough.