Click or drag to resize

UserInfoRemoveUserFromLocalGroup Method

Removes an existing user from the specified local groupName.

Namespace: GSF.Identity
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
public static bool RemoveUserFromLocalGroup(
	string groupName,
	string userName
)
View Source

Parameters

groupName  String
Group name to remove local user from.
userName  String
Existing local user name.

Return Value

Boolean
true if user was removed from local group; otherwise, false meaning user did not exist in group.
Exceptions
ExceptionCondition
ArgumentNullExceptiongroupName or userName was null.
ArgumentExceptionNo groupName or userName was specified.
InvalidOperationExceptionCould not remove user from local group.
Remarks
This function will handle Windows service virtual accounts by specifying the complete virtual account name, such as @"NT SERVICE\MyService", as the userName. This function can also remove Active Directory user accounts and groups from the local group the when the userName is prefixed with a domain name and a backslash "\".
See Also