473,472 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

finding workgroup name

Does anybody know how to find the workgroup name (or domainname) of the
local PC. Is there a framework class for it?

(preferably a solution not involving active directory calls)

Thanks,
Ewart.
Nov 15 '05 #1
7 1810
Ewart,

To find the domain name --
MessageBox.Show(Environment.UserDomainName.ToStrin g)
To find the machine name --
MessageBox.Show(Environment.MachineName.ToString)

Let me know if this works.

Cheers,
Gary
"Ewart MacLucas" <ew************@aut.ac.nz> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
Does anybody know how to find the workgroup name (or domainname) of the
local PC. Is there a framework class for it?

(preferably a solution not involving active directory calls)

Thanks,
Ewart.

Nov 15 '05 #2
Thanks Gary but unfortunately both functions just return the computer name
of the current machine, not the domain to which I'am attached. Any other
ideas? (ps, preferably not a WMI solution either! :-))

Regards,
Ewart.

"Gary" <ms****@microsoft.com> wrote in message
news:uk*************@TK2MSFTNGP11.phx.gbl...
Ewart,

To find the domain name --
MessageBox.Show(Environment.UserDomainName.ToStrin g)
To find the machine name --
MessageBox.Show(Environment.MachineName.ToString)

Let me know if this works.

Cheers,
Gary
"Ewart MacLucas" <ew************@aut.ac.nz> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
Does anybody know how to find the workgroup name (or domainname) of the
local PC. Is there a framework class for it?

(preferably a solution not involving active directory calls)

Thanks,
Ewart.


Nov 15 '05 #3
Gary wrote:
To find the domain name --
MessageBox.Show(Environment.UserDomainName.ToStrin g)
To find the machine name --
MessageBox.Show(Environment.MachineName.ToString)


Both properties are string's, hence ToString() ist not necessary.

Best regards,

Michael

--
Michael Kremser
http://great.dynu.com/

Nov 15 '05 #4
Cor
Michael,
This works for me
\\\\
Dim environmentVariables As IDictionary =
Environment.GetEnvironmentVariables()
Dim de As DictionaryEntry
For Each de In environmentVariables
If de.Key.ToString = "USERDOMAIN" Then
MessageBox.Show(de.Value.ToString)
Next de
////
I hope for you too?
Cor
Nov 15 '05 #5
Cor
Gary,
This works for me
\\\\
Dim environmentVariables As IDictionary =
Environment.GetEnvironmentVariables()
Dim de As DictionaryEntry
For Each de In environmentVariables
If de.Key.ToString = "USERDOMAIN" Then
MessageBox.Show(de.Value.ToString)
Next de
////
I hope for you too?
Cor

Nov 15 '05 #6
Cor
Michael,
Wrong thread sorry
Cor
Nov 15 '05 #7
Ewart,

This line of code works certainly works for me :
MessageBox.Show(Environment.UserDomainName)

Are you sure you are trying to get the Domain name ?

- Gary

"Ewart MacLucas" <ew************@aut.ac.nz> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Thanks Gary but unfortunately both functions just return the computer name
of the current machine, not the domain to which I'am attached. Any other
ideas? (ps, preferably not a WMI solution either! :-))

Regards,
Ewart.

"Gary" <ms****@microsoft.com> wrote in message
news:uk*************@TK2MSFTNGP11.phx.gbl...
Ewart,

To find the domain name --
MessageBox.Show(Environment.UserDomainName.ToStrin g)
To find the machine name --
MessageBox.Show(Environment.MachineName.ToString)

Let me know if this works.

Cheers,
Gary
"Ewart MacLucas" <ew************@aut.ac.nz> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
Does anybody know how to find the workgroup name (or domainname) of the local PC. Is there a framework class for it?

(preferably a solution not involving active directory calls)

Thanks,
Ewart.



Nov 15 '05 #8

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

Similar topics

7
by: Ewart MacLucas | last post by:
Does anybody know how to find the workgroup name (or domainname) of the local PC. Is there a framework class for it? (preferably a solution not involving active directory calls) Thanks,...
1
by: Trina | last post by:
Hello, Why would a member of workgroup not get a logon prompt when opening the database? Trina
7
by: Paul T. Rong | last post by:
A card where I wrote my name and WID (work group ID) was stolen (unfortunately together with other things), therotically the one who have my name and WID can create the same mdw file which I use...
3
by: Mark | last post by:
I have a server in a workgroup (called "wg"). Does anyone know how to find the name of the workgroup from code (pref c#)? I've trawled the newsgroups and the MSDN site for the right class / method...
3
by: Bryan | last post by:
We created a Windows Service with C#. The service will start OK on computers that are a member of a domain, but when we try to start it on a server that is configured for a workgroup we get the...
3
by: zav | last post by:
Hi all. Getting stright to the point Im trying to get and set my computers workgroup name but im having litle luck, i've tryed: Environment.UserDomainName Environment.MachineName but they...
11
by: Mark Hollander | last post by:
How do I get the name of the Workgroup or Domain that the computer has been registered in. Thank you Mark Hollander
1
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
6
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
muto222
php
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.