public static LocalGroupExists ( string groupName ) : bool | ||
groupName | string | Group name to test for existence. |
return | bool |
public static bool LocalGroupExists(string groupName)
{
if ((object)groupName == null)
throw new ArgumentNullException(nameof(groupName));
// Remove any irrelevant white space
groupName = groupName.Trim();
if (groupName.Length == 0)
throw new ArgumentException("No group name was specified.", nameof(groupName));
groupName = ValidateGroupName(groupName);
if (Common.IsPosixEnvironment)
return UnixUserInfo.LocalGroupExists(groupName);
return WindowsUserInfo.LocalGroupExists(groupName);
}