List Groups Computer Account is a Member of ASP.Net VB
I notice you have an example code of listing groups Ad开发者_C百科 computer Accounts are a member of in c#, do you have an example in vb ?
Cheers
Andy
not really related to AD, but in most cases you can use Reflector to translate C# to VB.NET (& vice versa), just create a compilable dll with your code and dissamble it with Reflector in VB.NET code.
You could use PrincipalContext:
Imports System.DirectoryServices.AccountManagement
Module Module1
Sub Main()
Using ctx As New PrincipalContext(ContextType.Domain)
Using p = Principal.FindByIdentity(ctx, "your_account_name")
If Not p Is Nothing Then
Dim groups = p.GetGroups()
Using groups
For Each group In groups
Console.WriteLine("{0} - {1}", group.SamAccountName, group.DisplayName)
Next
End Using
End If
End Using
End Using
End Sub
End Module
精彩评论