MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
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) Else isMember = False End If End Using Return isMember End Function Private Sub Button15_Click_1(sender As Object, e As EventArgs) Handles Button15.Click Dim str As String = tbUser.Text str = str.Remove(0, 5) Dim localusrname As String = str If IsMemberOfGroup(localusrname, TextBox1.Text, "administrators") Then tbadmin.Text = "Admin rights granted to " & tbUser.Text & " on Workstation: " & TextBox1.Text & " and Primary User has been updated in the local Registry." Else tbadmin.Text = "Admin rights have not been updated yet for " & tbUser.Text & " on Workstation: " & TextBox1.Text & "." & " Make sure you run the Fix Admin Rights tool first!" & " If you have, please verify it is successful and the user has access to the correct group, then reboot and re-check." End If End Sub
|How do I bind a WPF ComboBox to an ItemSource using XAML?||2||28|
|ASP.NET MVC -Update model when click on <li> element||29||65|
|How can I do Unit Testing with Session ?||1||23|
|VB.net Is there code behind PowerPivot||2||43|