public static bool RemoveUserFromLocalGroup(string groupName, string userName)
{
if ((object)groupName == null)
throw new ArgumentNullException(nameof(groupName));
if ((object)userName == null)
throw new ArgumentNullException(nameof(userName));
// Remove any irrelevant white space
groupName = groupName.Trim();
userName = userName.Trim();
if (groupName.Length == 0)
throw new ArgumentException("Cannot remove user from local group: no group name was specified.", nameof(groupName));
if (userName.Length == 0)
throw new ArgumentException("Cannot remove user from local group: no user name was specified.", nameof(userName));
groupName = ValidateGroupName(groupName);
if (Common.IsPosixEnvironment)
return UnixUserInfo.RemoveUserFromLocalGroup(groupName, userName);
return WindowsUserInfo.RemoveUserFromLocalGroup(groupName, userName);
}