Windows Vista Forums

Know a .NET Class that can be used to join local computer to a domain

  1. #1


    andy@nodisabilities.com Guest

    Know a .NET Class that can be used to join local computer to a domain

    Does anyone know of a .NET class that can be used to join a local
    computer to a domain ?


      My System SpecsSystem Spec

  2. #2


    Keith Hill [MVP] Guest

    Re: Know a .NET Class that can be used to join local computer to a domain

    <andy@nodisabilities.com> wrote in message
    news:1185311386.809615.29170@i38g2000prf.googlegroups.com...
    > Does anyone know of a .NET class that can be used to join a local
    > computer to a domain ?
    >


    I don't know of a .NET type but in the Win32 API you can use
    NetJoinDomain(). You could create a simple WIN32 console exe around this
    API.

    --
    Keith


      My System SpecsSystem Spec

  3. #3


    Brandon Shell Guest

    Re: Know a .NET Class that can be used to join local computer to a domain

    Can I suggest

    $compObject = get-wmiobject Win32_ComputerSystem -computername $computer
    $compJoinDomainOrWorkgroup($domain,$password,$username,$joinops)

    Here is some more info
    http://msdn2.microsoft.com/en-us/library/aa392154.aspx

    ----- Text from article -----

    Name
    [in] Specifies the domain or workgroup to join. Cannot be NULL.

    Password
    [in] If the UserName parameter specifies an account name, the Password
    parameter must point to the password to use when connecting to the domain
    controller. Otherwise, this parameter must be NULL.

    UserName
    [in] Pointer to a constant null-terminated character string that specifies
    the account name to use when connecting to the domain controller. Must
    specify a domain NetBIOS name and user account, for example, Domain\user. If
    this parameter is NULL, the caller information is used.
    You can also use the user principal name (UPPED) in the form user@domain.

    Windows 2000, Windows NT 4.0, and Windows Me/98/95: You cannot specify
    UserName in UPPED format.

    AccountOU
    [in, optional] Specifies the pointer to a constant null-terminated character
    string that contains the RFC 1779 format name of the organizational unit
    (OU) for the computer account. If you specify this parameter, the string
    must contain a full path, otherwise Accent must be NULL.
    Example: "OU=testOU, DC=domain, DC=Domain, DC=com"

    FJoinOptions
    [in] Set of bit flags that define the join options.Value Meaning
    1

    JoinOptioins
    0x1 Default. Joins a computer to a domain. If this value is not specified,
    the join is a computer to a workgroup.
    2
    0x2 Creates an account on a domain.
    4
    0x4 Deletes an account when a domain exists.
    16
    0x10 The join operation is part of an upgrade from Windows 98 or Windows 95
    to Windows 2000 or Windows NT.
    32
    0x20 Allows a join to a new domain even if the computer is already joined to
    a domain.
    64
    0x40 Performs an unsecured join.
    128
    0x80 The machine, not the user, password passed. This option is only valid
    for unsecure joins.
    256
    0x100 Writing SPN and DnsHostName attributes on the computer object should
    be deferred until the rename that follows the join.
    262144
    0x40000 The APIs were invoked during install.


    "Keith Hill [MVP]" <r_keith_hill@mailhot.moc_no_spam_I> wrote in message
    news:AF500845-0A5F-45B5-B20B-12836F1E3295@microsoft.com...
    > <andy@nodisabilities.com> wrote in message
    > news:1185311386.809615.29170@i38g2000prf.googlegroups.com...
    >> Does anyone know of a .NET class that can be used to join a local
    >> computer to a domain ?
    >>

    >
    > I don't know of a .NET type but in the Win32 API you can use
    > NetJoinDomain(). You could create a simple WIN32 console exe around this
    > API.
    >
    > --
    > Keith



      My System SpecsSystem Spec

  4. #4


    Thomas Lee Guest

    Re: Know a .NET Class that can be used to join local computer to a domain

    In message <1185311386.809615.29170@i38g2000prf.googlegroups.com>,
    andy@nodisabilities.com writes
    >Does anyone know of a .NET class that can be used to join a local
    >computer to a domain ?


    It's not a class - but a program:

    netdom.exe.
    --
    Thomas Lee
    doctordns@gmail.com
    MVP - Admin Frameworks and Security

      My System SpecsSystem Spec

  5. #5


    andy@nodisabilities.com Guest

    Re: Know a .NET Class that can be used to join local computer to a domain

    Thats actuall what I ended up using. Thanks

    Andy


    On Jul 25, 8:02 am, Thomas Lee <t...@psp.co.uk> wrote:
    > In message <1185311386.809615.29...@i38g2000prf.googlegroups.com>,
    > a...@nodisabilities.com writes
    >
    > >Does anyone know of a .NET class that can be used to join a local
    > >computer to a domain ?

    >
    > It's not a class - but a program:
    >
    > netdom.exe.
    > --
    > Thomas Lee
    > doctor...@gmail.com
    > MVP - Admin Frameworks and Security




      My System SpecsSystem Spec


Know a .NET Class that can be used to join local computer to a domain
Similar Threads
Thread Forum
Can't join computer to domain after PDC crash Server General
Can't join computer to domain after PDC crash Server General
Prompt To Join Computer To Domain Vista installation & setup
Join Vista Machine to Domain - Need info from local profile Vista General
Computer cannot join domain Vista networking & sharing