473,320 Members | 1,965 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,320 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.
Nov 20 '05 #1
7 4263
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 20 '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 20 '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 20 '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 20 '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 20 '05 #6
Cor
Michael,
Wrong thread sorry
Cor
Nov 20 '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 20 '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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.