469,585 Members | 2,189 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,585 developers. It's quick & easy.

Get local computers Workgroup name

zav
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 only retreive the local machine name.

Can anyone point me in the right direction.
Thanks.

P.s reason being, im writing a small app for changing NIC settings on the fly.
Nov 17 '05 #1
3 8544
To retrieve the workgroup, try
System.Environment.GetEnvironmentVariable("USERDOM AIN"). This may not always
work depending on who is logged in. For example, if you use this command
from an ASP.NET page, you will get a workgroup of "NT Authority" because of
the settings of the default user.

Hope this helps.

--
Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce
"zav" wrote:
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 only retreive the local machine name.

Can anyone point me in the right direction.
Thanks.

P.s reason being, im writing a small app for changing NIC settings on the fly.

Nov 17 '05 #2

"zav" <za*@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
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 only retreive the local machine name.

Can anyone point me in the right direction.
Thanks.

P.s reason being, im writing a small app for changing NIC settings on the
fly.


What exactly are you trying to achieve?
NIC settings have nothing to do with "Computers workgroup" names.

Willy.
Nov 17 '05 #3
zav
Thats correct they dont, however im providing myself with multiple network
profiles. With the information i have im able to load a different profile
<NIC settings> and im able to use the net at work, and with a simple button
click im able to change my profile back to home <no playing about adding and
removing the tcp/ip settings for different location>.

The workgroup name problem was really only something i was curious about,
given i could get all other information i thought it would be an idea to
enable profiles to get / set workgroup information for different locations,
enabling access to network resources in different locations <e.g home =
MSHOME, work = MSWORK>.

I hope this shows my intentions.

Zav.
"Willy Denoyette [MVP]" wrote:

"zav" <za*@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
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 only retreive the local machine name.

Can anyone point me in the right direction.
Thanks.

P.s reason being, im writing a small app for changing NIC settings on the
fly.


What exactly are you trying to achieve?
NIC settings have nothing to do with "Computers workgroup" names.

Willy.

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Steve | last post: by
6 posts views Thread by kimiraikkonen | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.