Skip to content

UsrMgr_IsUserMemberOfLocalGroup

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.

UsrMgr_IsUserMemberOfLocalGroup(sGroupName, sUsername) As Boolean

Name or SID of the local group. The name isn’t case sensitive.

Name of the user in the same format that UsrMgr_EnumMembersOfLocalGroup returns, for example DOMAIN\Username. The comparison isn’t case sensitive.

The result will be stored in gbValue: True if the user is a direct member of the group, otherwise False.

If bStatus Then bStatus = UsrMgr_IsUserMemberOfLocalGroup("Administrators", "Domain\Username")
If bStatus Then bStatus = Job_WriteLog("Custom", "gbValue: " & gbValue,bStatus,True)

Scripting Guidelines

UsrMgr_CreateLocalUser UsrMgr_CreateLocalGroup UsrMgr_EnumMembersOfLocalGroup Constants Package Property Variables