Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB6 - How to list network domains and/or users

VB6 - How to list network domains and/or users

Scheduled Pinned Locked Moved Visual Basic
questionsysadminjsontutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    steff kamush
    wrote on last edited by
    #1

    How can I list network domains and/or users in Win NT, 2000 and XP in VB6? Anyone know an API or other way I will appreciate. :rose::rose: 1fm1fu

    J 1 Reply Last reply
    0
    • S steff kamush

      How can I list network domains and/or users in Win NT, 2000 and XP in VB6? Anyone know an API or other way I will appreciate. :rose::rose: 1fm1fu

      J Offline
      J Offline
      jonathan15
      wrote on last edited by
      #2

      I found these examples a while ago (can't remember where sorry). They are for VB script but you will get the idea. LISTING 1: The GetAvailableNTDomains Procedure '---------------------------------------------------------------- ' Function: GetAvailableNTDomains ' Description: Returns a listing of available NT Domains ' Parameters: None ' Returns: Variant array of NT Domain names. '---------------------------------------------------------------- Public Function GetAvailableNTDomains() Dim objIADsContainer ' ActiveDs.IADsContainer Dim objIADsDomain ' ActiveDs.IADsDomain Dim vReturn ' Variant ReDim vReturn(0) Set objIADsContainer = GetObject("WinNT:") For Each objIADsDomain In objIADsContainer If Trim(vReturn(0)) <> "" Then ReDim Preserve vReturn(UBound(vReturn) + 1) End If vReturn(UBound(vReturn)) = objIADsDomain.Name Next Set objIADsDomain = Nothing Set objIADsContainer = Nothing GetAvailableNTDomains = vReturn End Function LISTING 2: The GetDomainComputers Procedure '---------------------------------------------------------------- ' Function: GetDomainComputers ' Description: Returns a listing of NT Computer Accounts for a ' given domain ' Parameters: ByVal strDomain - Name of an NT Domain to retrieve ' the list of Computer from. ' Returns: Variant array of NT Computer names for the ' specified domain. '---------------------------------------------------------------- Public Function GetDomainComputers(ByVal strDomain) Dim objIADsContainer ' ActiveDs.IADsDomain - ' Container object Dim objIADsComputer ' ActiveDs.IADsComputer Dim vReturn ' Variant ' connect to the computer. Set objIADsContainer = GetObject("WinNT://" & strDomain) ' set the filter to retrieve only objects of class Computer objIADsContainer.Filter = Array("Computer") ReDim vReturn(0) For Each objIADsComputer In objIADsContainer If Trim(vReturn(0)) <> "" Then ReDim Preserve vReturn(UBound(vReturn) + 1) End If vReturn(UBound(vReturn)) = objIADsComputer.Name Next GetDomainComputers = vReturn Set objIADsComputer = Nothing Set objIADsContainer = Nothing End Function The GetComputerUsers Procedure '---------------------------------------------------------------- ' Function: GetComputerUsers ' Description: This function will return the names of the users

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups