Get local computers Workgroup name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
To retrieve the workgroup, try
System.Environment.GetEnvironmentVariable("USERDOMAIN"). 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.
 
zav said:
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.
 
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.
 
Back
Top