CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Domain

  1. #1
    Join Date
    Jun 1999
    Location
    Georgia
    Posts
    24

    Domain

    Can someone tell me how I can retrieve the domain name a machine belongs to???

    Is there a specfic NET API that I could use

    I really need this badly so if someone has any suggestions it would be greatly appreciated...


    Thanks
    tcompe


  2. #2
    Join Date
    Feb 2000
    Location
    Indiana
    Posts
    308

    Re: Domain

    What's your platform? NT has API functions available to do this, but Win9x does not.


  3. #3
    Join Date
    Jun 1999
    Location
    Georgia
    Posts
    24

    Re: Domain

    Sorry...forgot to mention that

    NT


  4. #4
    Join Date
    Feb 2000
    Location
    Indiana
    Posts
    308

    Re: Domain

    NetAPI32.dll has a function called NetWkstaUserGetInfo which, when called with the parameter "level" set to 1101 return a space seperated list of domains accessed by the workstation. This may work for you. I've never used it in VB, so maybe someone who has can help you with the call.


  5. #5
    Join Date
    Feb 2000
    Location
    Indiana
    Posts
    308

    Re: Domain

    Almost forgot...
    take a look at HKEY_LOCAL_MACHINE\Security\Provider


  6. #6
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Domain

    i'm running Win NT workstation 4 (sp3). i don't have a provider hive under the security hive. In fact, my security folder is empty. could it be permissions? I'm not sure how that could be, I am in the admin group on the local machine.

    oh well.

    John

    John Pirkey
    MCSD
    www.ShallowWaterSystems.com
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  7. #7
    Join Date
    Feb 2000
    Location
    Indiana
    Posts
    308

    Re: Domain

    Maybe do an Edit...Find on your registry for the name of your domain?


  8. #8
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Domain

    I found it in these two places:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\CachePrimaryDomain


    Just FYI.

    Thanks,
    john

    John Pirkey
    MCSD
    www.ShallowWaterSystems.com
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured