Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Public Shared Function IsMemberOfGroup(userName As String, machineName As String, memberGroup As String) As Boolean Dim isMember As Boolean = False Using rootContext As New PrincipalContext(ContextType.Machine, machineName), _ grp As GroupPrincipal = GroupPrincipal.FindByIdentity(rootContext, memberGroup), _ usr As UserPrincipal = UserPrincipal.FindByIdentity(rootContext, IdentityType.SamAccountName, userName) If grp IsNot Nothing AndAlso usr IsNot Nothing Then ' Check if the user is a member of the group. isMember = grp.GetMembers(True).Contains(usr) MsgBox("yay") Else isMember = False MsgBox("nah") End If End Using Return isMember End Function
IsMemberOfGroup(localusrname, TextBox1.Text, "administrators")
|VB.NET 2013-How to validate a textbox and set focus to next control if true?||4||54|
|VB.NET Repostiory Pattern||7||51|
|VB.Net - MemoryMappedFiles - Confirm receipt||2||24|
|VB.net Code to make a TaskPane float in Excel Add-in||2||9|