473,385 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.
Jul 21 '05 #1
7 3792
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.

Jul 21 '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.


Jul 21 '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/

Jul 21 '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
Jul 21 '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

Jul 21 '05 #6
Cor
Michael,
Wrong thread sorry
Cor
Jul 21 '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.



Jul 21 '05 #8

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

Similar topics

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...
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,...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.