Remove the local computer from a workgroup or domain.
Syntax Remove-Computer [[-Credential] PSCredential] [-Force] [-PassThru] [-Confirm] [-WhatIf] [CommonParameters] Key -Credential PSCredential A user account that has permission to perform this action. The default is the current user. Type a user name, such as "User64" or "Domain64\User64", or enter a PSCredential object, such as one generated by Get-Credential. If you type a user name, you will be prompted for a password. To remove a computer from a domain, you must use -Credential, even when using the credentials of the current user. -Force Override any restrictions that would prevent the command from succeeding, apart from security settings. -PassThru Return the results of the command. Otherwise, this cmdlet does not generate any output. -confirm Prompt for confirmation before executing the command. -whatIf Describe what would happen if you executed the command without actually executing the command. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.
Remove-Computer removes the local computer from its current workgroup or domain.
When a computer is removed from a domain, Remove-Computer will also disable the computer's domain account.
Restart the computer to make the change effective.
Use the -Verbose and -PassThru parameters to view the results of the command.
Remove the local computer from the domain to which it is joined:
PS C:> remove-computer -credential domain64\admin64 -passthru -verbose; restart-computer
“No amount of time can erase the memory of a good cat, and no amount of masking tape can ever totally remove his fur from your couch” ~ Leo F. Buscaglia
Add-Computer - Add a computer to the domain
Restart-Computer - Restart the operating system on a computer