473,796 Members | 2,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get Domain/Workgroup name of PC Registration

How do I get the name of the Workgroup or Domain that the computer has
been registered in.

Thank you
Mark Hollander

Thank you
Mark Hollander
Nov 20 '05 #1
11 5603
On Wed, 14 Jul 2004 16:44:12 +0200, Mark Hollander <ma**@atcom.co. za> wrote:

¤ How do I get the name of the Workgroup or Domain that the computer has
¤ been registered in.
¤

The following uses ADSI:

Dim SystemInfo As Object

SystemInfo = CreateObject("A DSystemInfo")
Console.WriteLi ne(SystemInfo.D omainShortName)
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)
Nov 20 '05 #2
You can use WMI as well...

Dim computer as New WMISample.ROOT. CIMV2.ComputerS ystem

computer.path =
System.Manageme nt.ManagementPa th("MyComp\root \CIMV2:Win32_Co mputerSystem.Na m
e=""MyComp""" )

Messagebox.Show (computer.Domai n) //Shows Domain name or Workgroup name)

Telmo Sampaio

"Mark Hollander" <ma**@atcom.co. za> wrote in message
news:si******** *************** *********@4ax.c om...
How do I get the name of the Workgroup or Domain that the computer has
been registered in.

Thank you
Mark Hollander

Thank you
Mark Hollander

Nov 20 '05 #3
The problem is that I cannot use these 2 examples on a
Windows98/WindowsME machine.

Is there any other way I can get the Workgroup/Domain name

Thank You
Mark Hollander

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4
I can't seem to get the WMI to work in VD.NET, what am i supposed to
include in the references to access the WMI.

Thank You
Mark Hollander

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5
On Thu, 15 Jul 2004 01:10:09 -0700, Mark Hollander <ma**@atcom.co. za> wrote:

¤ The problem is that I cannot use these 2 examples on a
¤ Windows98/WindowsME machine.
¤
¤ Is there any other way I can get the Workgroup/Domain name
¤

How about the following:

Environment.Use rDomainName()
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)
Nov 20 '05 #6
Paul,

Sometimes I am blinded by the simplicity of things... I have to agree that
using the Environment class is a lot easier than dealing with WMI.

Thanks,

Telmo
"Paul Clement" <Us************ ***********@sws pectrum.com> wrote in message
news:rp******** *************** *********@4ax.c om...
On Thu, 15 Jul 2004 01:10:09 -0700, Mark Hollander <ma**@atcom.co. za> wrote:
¤ The problem is that I cannot use these 2 examples on a
¤ Windows98/WindowsME machine.
¤
¤ Is there any other way I can get the Workgroup/Domain name
¤

How about the following:

Environment.Use rDomainName()
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)

Nov 20 '05 #7
Imports System.Manageme nt - add a reference to this too.

(VD.NET??? Is that next version of AIDS?? :D)
_______________ ______________
The Grim Reaper

"Mark Hollander" <ma**@atcom.co. za> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I can't seem to get the WMI to work in VD.NET, what am i supposed to
include in the references to access the WMI.

Thank You
Mark Hollander

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #8
The problem with this function is that it returns the domain name that
the user logged onto.

Scenario

Computer is registered in DomainA
User is registered in DomainB

I want the DomainA name but I get DomainB as the domain name when I use
System.Environm ent.UserDomainN ame.

It is important that I get DomainA
Thank You
Mark Hollander

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #9
Did that but I cannot seem to access the following:
Dim computer as New WMISample.ROOT. CIMV2.ComputerS ystem

The MSDN is vague on how to access this as I cannot seem to find
anything relating to it.

Thank You
Mark Hollander

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1519
by: Manoj | last post by:
Hi, How can we get info as to if a terminal is on a workgroup or a domain and the name of the domain\workgroup in windows 2000 professional through code thanks in advance Manoj
2
1990
by: Jordan | last post by:
Suppose I register a domain name, MyDomain.com, through register.com (or any other of the many domain name registrars). I own the domain name. The domain name goes into the global DNS database. As the facilitator in this process, exactly what does the registrar *own* with respect to my specific domain name and/or the registration process? Briefly, what role does InterNIC play in all of this?
1
4099
by: Bilge TUTAK | last post by:
Hi, I want to find the list of the computer names in a workgroup or in a domain. Is there a way to do this in VB.NET? Thanx
2
1653
by: Richard L Rosenheim | last post by:
On my development machine, it works -- SystemInformation.UserDomainName and System.Environment.UserDomainName both returns the domain name. But, on my test machine, these methods are returning the computer name. Both systems are running Framework 1.1 w/SP 1 installed. The code was compiled using VS 2003 (VB.NET). Is the problem that the test machine belongs to a workgroup, and not a domain? If so, how to determine the workgroup name?
6
7687
by: Spyder | last post by:
When you go to "MyComputer" and get properties and select "Computer Name", you get the Domain or Workgroup a computer belongs to. I have looked thru MSDN library, the Internet, the Registry and in all files on my computer and cannot find how to retrieve this information in VB.Net 2005. This information is essential for our system implementation. I have tried: NetworkInformation.IPGlobalProperties.GetIPGlobalProperties but it does not...
6
2171
by: MLH | last post by:
I'm tired of reading the fine print! Too many registrars out there. So I'm asking this group for a little help. I'm looking for a Registrar who will do an honest day's work for a fair price. I'm tired of Registrars who build in "gotchas" into their service offering that nab you for something more than you bargain for - including the right to screw you later in their fine print. I want a registrar who won't charge you to leave them....
8
37036
by: None | last post by:
Hi, If anybody knows how to get the domain name(only domain name) of the system pls let me know. Thanks and Regards, Vinothkumar B bvinoth@tvsinfotech.com
9
1612
by: =?Utf-8?B?RGVubmlz?= | last post by:
I am trying to get all the user info in my home network domain using WMI but the below code returns nothing. I know the domain name I pass is correct, i.e., "mshome". I cut and pasted this code from an example I found on the internet. Public Shared Function GetUsersInfoCollection(ByVal domain As String) As ManagementObjectCollection Dim query As ManagementObjectSearcher Dim queryCollection As ManagementObjectCollection Dim msc As...
0
1810
by: conniezhang | last post by:
Dear Valued Businessman/BusinessLady, Todaynic.com is one of the first ICANN Accredited Registrars and CNNIC Accredited Domestic Registrars in China. Great amount of domain extensions with low prices and provide VDNS (Virtual Domain Name Server) services of its Secondary Domain Name. 10XGE FDDI directly to ChinaNet to ensure stability and high speed. CyberIP, Anti-spam email, Website DIY,Internet call cards. SCP's auto management(Smart...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10465
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.