UsrMgr_IsUserMemberOfLocalGroup
Description
Section titled “Description”Checks whether a user is a member of a local group. This function only checks direct membership. Membership through nested groups isn’t detected.
If the group doesn’t exist, the function returns True and gbValue is False.
Syntax
Section titled “Syntax”UsrMgr_IsUserMemberOfLocalGroup(sGroupName, sUsername) As Boolean
Parameters
Section titled “Parameters”sGroupName (String)
Section titled “sGroupName (String)”Name or SID of the local group. The name isn’t case sensitive.
sUsername (String)
Section titled “sUsername (String)”Name of the user in the same format that UsrMgr_EnumMembersOfLocalGroup returns, for example DOMAIN\Username. The comparison isn’t case sensitive.
Return value
Section titled “Return value”The result will be stored in gbValue: True if the user is a direct member of the group, otherwise False.
Example
Section titled “Example”If bStatus Then bStatus = UsrMgr_IsUserMemberOfLocalGroup("Administrators", "Domain\Username")If bStatus Then bStatus = Job_WriteLog("Custom", "gbValue: " & gbValue,bStatus,True)Related functions
Section titled “Related functions”UsrMgr_CreateLocalUser UsrMgr_CreateLocalGroup UsrMgr_EnumMembersOfLocalGroup Constants Package Property Variables