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\ CurrentCon trolSet\Se rvices\Vxd \VnetSup\W orkGroup
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?
I have read other answers that deal with obtaining the workgroup in the registry under the following path:
HKEY_LOCAL_MACHINE\System\
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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=imper sonate}!\\ " _
& 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
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=imper
& 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
http://vbnet.mvps.org/index.html?code/enums/
S