Remove the local computer from a workgroup or domain.

      Remove-Computer [[-Credential] PSCredential] [-Force] [-PassThru]
         [-Confirm] [-WhatIf] [CommonParameters]

   -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.

       Override any restrictions that would prevent the command from succeeding,
       apart from security settings.

       Return the results of the command. Otherwise, this cmdlet does not generate any output.

       Prompt for confirmation before executing the command.

       Describe what would happen if you executed the command without actually
       executing the command.

       -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

© Copyright 1999-2015
Some rights reserved