Link to home
Start Free TrialLog in
Avatar of dzumwalt
dzumwalt

asked on

How do I get the WORKGROUP in XP Home.

I am writing a VB6 application that will need to obtain the workgroup.

I have read other answers that deal with obtaining the workgroup in the registry under the following path:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Vxd\VnetSup\WorkGroup

The problem is that when I look on my PC (running XP-Home) there is no Vxd key under the services branch. Assuming that it must be something specific to my operating system, what method can I use to obtain the workgroup regardless of the OS?
Avatar of Shauli
Shauli

ASKER CERTIFIED SOLUTION
Avatar of Shauli
Shauli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Way 1:
Obtaining Workstation Configuration and Current User
http://vbnet.mvps.org/code/network/netwkstagetinfousername.htm

Way 2:
Using WMI (NT4 or better required)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__accounts_and_domains.asp

Dim strComputer As String
Dim objWMIService As Object
Dim colSettings As Object
Dim objComputer As Object

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
For Each objComputer In colSettings
    Debug.Print "System Name: " & objComputer.Name
    Debug.Print "Domain: " & objComputer.domain
Next