Get local computers Workgroup name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zav

    #1

    Get local computers Workgroup name

    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.Use rDomainName
    Environment.Mac hineName

    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.
  • Bruce Johnson [C# MVP]

    #2
    RE: Get local computers Workgroup name

    To retrieve the workgroup, try
    System.Environm ent.GetEnvironm entVariable("US ERDOMAIN"). 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:
    [color=blue]
    > 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.Use rDomainName
    > Environment.Mac hineName
    >
    > 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.[/color]

    Comment

    • Willy Denoyette [MVP]

      #3
      Re: Get local computers Workgroup name


      "zav" <zav@discussion s.microsoft.com > wrote in message
      news:53447E41-4EE1-48FE-A97C-E0BDF67EDAC2@mi crosoft.com...[color=blue]
      > 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.Use rDomainName
      > Environment.Mac hineName
      >
      > 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.[/color]

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

      Willy.


      Comment

      • zav

        #4
        Re: Get local computers Workgroup name

        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:
        [color=blue]
        >
        > "zav" <zav@discussion s.microsoft.com > wrote in message
        > news:53447E41-4EE1-48FE-A97C-E0BDF67EDAC2@mi crosoft.com...[color=green]
        > > 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.Use rDomainName
        > > Environment.Mac hineName
        > >
        > > 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.[/color]
        >
        > What exactly are you trying to achieve?
        > NIC settings have nothing to do with "Computers workgroup" names.
        >
        > Willy.
        >
        >
        >[/color]

        Comment

        Working...