MaDMaRTiGaN Posted January 5, 2006 Posted January 5, 2006 Hi, I'm trying to create a web page which allows me to list the members of the local Administrators group of a client system. I found some code parts which can list the members (using WMI) but these cannot add or remove members from the group. I switched to using a DirectoryEntry object but when I run the code below, only one account is returned although the administrators group contains more (both local and domain) accounts. (note that txtOutput is a textbox on my webpage). Can someone help me out? Dim strComputer As String = "computer" Dim strAccount As String = "administrator" Dim strPassword As String = "secret" Dim locPath As String = "WinNT://" & strComputer & "/Administrators,group" Dim localGroup As DirectoryEntry localGroup = New DirectoryEntry(locPath, strComputer & "\" & strAccount, strPassword) Dim allMembers As Object = localGroup.Invoke("Members") Dim groupMember As Object For Each groupMember In CType(allMembers, IEnumerable) Dim member As New DirectoryEntry(groupMember) txtOutput.Text = txtOutput.Text & member.Path & vbCrLf Next Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.