UnjoinDomainOrWorkgroup method of the Win32_ComputerSystem Class
Applies to: desktop apps only
The UnjoinDomainOrWorkgroup method removes a computer system from a domain or workgroup.
This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.
Syntax
uint32 UnjoinDomainOrWorkgroup( [in] string Password, [in] string UserName, [in] uint32 FUnjoinOptions = 0 );
Parameters
- 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.
Note Password must use a high authentication level, not less than RPC_C_AUTHN_LEVEL_PKT_PRIVACY, when connecting to Winmgmt or CoSetProxyBlanket on the IWbemServices pointer. If local to Winmgmt, this is not a concern.
- 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 context is used.
Windows Server 2003 and Windows XP: Using the user principal name (UPN) in the form of user@domain is also supported.Note UserName must use a high authentication level, not less than RPC_C_AUTHN_LEVEL_PKT_PRIVACY, when connecting to Winmgmt or CoSetProxyBlanket on the IWbemServices pointer. If local to Winmgmt, this is not a concern.
- FUnjoinOptions [in]
-
Set of bit flags defining the unjoin options.
Value Meaning - 0
Default. No options.
- NETSETUP_ACCT_DELETE
- 2
Disable the Active Directory account after the unjoin operation, but do not delete the account.
Remarks
After calling this method, restart the affected computer to apply the changes.
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
For C++ code examples, see WMI C++ Application Examples.
Requirements
|
Minimum supported client | Windows XP |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
Namespace |
\root\CIMV2 |
|
MOF |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 3/9/2012
For instance, I'm getting 1004 returned. Just what is the error? Why is it being returned rather than 0? How do I solve it?
- 12/14/2009
- Mark Crossland