Click or drag to resize

UserInfoUserIsInLocalGroup Method

Determines if user is in the specified local groupName.

Namespace: GSF.Identity
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.313-beta+5fa9ed2a8819cbb219f1e178bdad6a8d23dec2ce
Syntax
public static bool UserIsInLocalGroup(
	string groupName,
	string userName
)
View Source

Parameters

groupName  String
Group name to test.
userName  String
User name to test.

Return Value

Boolean
true if user is in group; otherwise, false.
Exceptions
ExceptionCondition
ArgumentNullExceptiongroupName or userName was null.
ArgumentExceptionNo groupName or userName was specified.
InvalidOperationExceptionCould not determine if user was in 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 detect Active Directory user accounts and groups that may exist in the local group when the userName is prefixed with a domain name and a backslash "\".
See Also