NetGetJoinableOUs function (lmjoin.h)
The NetGetJoinableOUs function retrieves a list of organizational units (OUs) in which a computer account can be created.
Syntax
NET_API_STATUS NET_API_FUNCTION NetGetJoinableOUs(
[in] LPCWSTR lpServer,
[in] LPCWSTR lpDomain,
[in] LPCWSTR lpAccount,
[in] LPCWSTR lpPassword,
[out] DWORD *OUCount,
[out] LPWSTR **OUs
);
Parameters
[in] lpServer
Pointer to a constant string that specifies the DNS or NetBIOS name of the computer on which to call the function. If this parameter is NULL, the local computer is used.
[in] lpDomain
Pointer to a constant string that specifies the name of the domain for which to retrieve the list of OUs that can be joined.
[in] lpAccount
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.
[in] lpPassword
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.
[out] OUCount
Receives the count of OUs returned in the list of joinable OUs.
[out] OUs
Pointer to an array that receives the list of joinable OUs. This array is allocated by the system and must be freed using a single call to the NetApiBufferFree function. For more information, see Network Management Function Buffers and Network Management Function Buffer Lengths.
Return value
If the function succeeds, the return value is NERR_Success.
If the function fails, the return value can be one of the following error codes or one of the system error codes.
Return code | Description |
---|---|
|
Not enough storage is available to process this command. |
|
The destination domain controller does not support creating computer accounts in OUs. |
Remarks
No special group membership is required to successfully execute the NetGetJoinableOUs function.
For more information about organizational units, see Managing Users in the Active Directory documentation.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | lmjoin.h (include Lm.h) |
Library | Netapi32.lib |
DLL | Netapi32.dll |