NetUnjoinDomain (netapi32)
Last changed: -145.85.3.29

.
Summary
TODO - a short description

C# Signature:

[DllImport("netapi32.dll", SetLastError=true, CharSet = CharSet.Auto)]
static extern int NetUnjoinDomain(
    string lpServer,
    string lpAccount,
    string lpPassword,
    UnJoinOptions fUnjoinOptions
    );

C# User-Defined Types:

[Flags]
public enum UnJoinOptions
{
    NONE = 0x00000000,
    NETSETUP_ACCT_DELETE = 0x00000004
}

VB.NET Signature:

    <DllImport("netapi32.dll", CharSet:=CharSet.Unicode, SetLastError:=True)> _
    Private Shared Function NetUnjoinDomain( _
      ByVal lpServer As String, _
      ByVal lpAccount As String, _
      ByVal lpPassword As String, _
      ByVal fUnJoinOptions As UnJoinOptions) As Integer
    End Function

VB.NET User-Defined Types:

    Private Enum UnJoinOptions
      None = 0
      NETSETUP_ACCT_DELETE = 4
    End Enum

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

lpServer - (in) Pointer to a constant string that specifies the DNS or NetBIOS name of the computer on which the function is to execute. If this parameter is NULL, the local computer is used.

lpAccount - (in) Pointer to a constant string that specifies the account name to use when connecting to the domain controller. The string must specify either a domain NetBIOS name and user account (for example, "REDMOND\user") or the user principal name (UPN) of the user in the form of an Internet-style login name (for example, "someone@example.com"). If this parameter is NULL, the caller's context is used.

lpPassword - (in) If the lpAccount parameter specifies an account name, this parameter must point to the password to use when connecting to the domain controller. Otherwise, this parameter must be NULL.

fUnjoinOptions - (in) Specifies the unjoin options. If this parameter is NETSETUP_ACCT_DELETE, the account is disabled when the unjoin occurs. Note that this option does not delete the account. Currently, there are no other unjoin options defined.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Documentation