finding workgroup name

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

    #1

    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.


  • Gary

    #2
    Re: finding workgroup name

    Ewart,

    To find the domain name --
    MessageBox.Show (Environment.Us erDomainName.To String)
    To find the machine name --
    MessageBox.Show (Environment.Ma chineName.ToStr ing)

    Let me know if this works.

    Cheers,
    Gary


    "Ewart MacLucas" <ewart.maclucas @aut.ac.nz> wrote in message
    news:uGF5jWzdDH A.3596@tk2msftn gp13.phx.gbl...[color=blue]
    > 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.
    >
    >[/color]


    Comment

    • Ewart MacLucas

      #3
      Re: finding workgroup name

      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" <msnews@microso ft.com> wrote in message
      news:ukX3IW1dDH A.568@TK2MSFTNG P11.phx.gbl...[color=blue]
      > Ewart,
      >
      > To find the domain name --
      > MessageBox.Show (Environment.Us erDomainName.To String)
      > To find the machine name --
      > MessageBox.Show (Environment.Ma chineName.ToStr ing)
      >
      > Let me know if this works.
      >
      > Cheers,
      > Gary
      >
      >
      > "Ewart MacLucas" <ewart.maclucas @aut.ac.nz> wrote in message
      > news:uGF5jWzdDH A.3596@tk2msftn gp13.phx.gbl...[color=green]
      > > 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.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Michael Kremser

        #4
        Re: finding workgroup name

        Gary wrote:
        [color=blue]
        > To find the domain name --
        > MessageBox.Show (Environment.Us erDomainName.To String)
        > To find the machine name --
        > MessageBox.Show (Environment.Ma chineName.ToStr ing)[/color]

        Both properties are string's, hence ToString() ist not necessary.

        Best regards,

        Michael

        --
        Michael Kremser


        Comment

        • Cor

          #5
          Re: finding workgroup name

          Michael,
          This works for me
          \\\\
          Dim environmentVari ables As IDictionary =
          Environment.Get EnvironmentVari ables()
          Dim de As DictionaryEntry
          For Each de In environmentVari ables
          If de.Key.ToString = "USERDOMAIN " Then
          MessageBox.Show (de.Value.ToStr ing)
          Next de
          ////
          I hope for you too?
          Cor


          Comment

          • Cor

            #6
            Re: finding workgroup name

            Gary,
            This works for me
            \\\\
            Dim environmentVari ables As IDictionary =
            Environment.Get EnvironmentVari ables()
            Dim de As DictionaryEntry
            For Each de In environmentVari ables
            If de.Key.ToString = "USERDOMAIN " Then
            MessageBox.Show (de.Value.ToStr ing)
            Next de
            ////
            I hope for you too?
            Cor



            Comment

            • Cor

              #7
              Re: finding workgroup name

              Michael,
              Wrong thread sorry
              Cor


              Comment

              • Gary

                #8
                Re: finding workgroup name

                Ewart,

                This line of code works certainly works for me :
                MessageBox.Show (Environment.Us erDomainName)

                Are you sure you are trying to get the Domain name ?

                - Gary

                "Ewart MacLucas" <ewart.maclucas @aut.ac.nz> wrote in message
                news:%23M6a4P2d DHA.2168@TK2MSF TNGP09.phx.gbl. ..[color=blue]
                > 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" <msnews@microso ft.com> wrote in message
                > news:ukX3IW1dDH A.568@TK2MSFTNG P11.phx.gbl...[color=green]
                > > Ewart,
                > >
                > > To find the domain name --
                > > MessageBox.Show (Environment.Us erDomainName.To String)
                > > To find the machine name --
                > > MessageBox.Show (Environment.Ma chineName.ToStr ing)
                > >
                > > Let me know if this works.
                > >
                > > Cheers,
                > > Gary
                > >
                > >
                > > "Ewart MacLucas" <ewart.maclucas @aut.ac.nz> wrote in message
                > > news:uGF5jWzdDH A.3596@tk2msftn gp13.phx.gbl...[color=darkred]
                > > > Does anybody know how to find the workgroup name (or domainname) of[/color][/color][/color]
                the[color=blue][color=green][color=darkred]
                > > > local PC. Is there a framework class for it?
                > > >
                > > > (preferably a solution not involving active directory calls)
                > > >
                > > > Thanks,
                > > > Ewart.
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                Working...