diff --git a/reference/3.0/Microsoft.PowerShell.Management/Remove-Computer.md b/reference/3.0/Microsoft.PowerShell.Management/Remove-Computer.md index 41da21d26a7b..827c7661f377 100644 --- a/reference/3.0/Microsoft.PowerShell.Management/Remove-Computer.md +++ b/reference/3.0/Microsoft.PowerShell.Management/Remove-Computer.md @@ -1,88 +1,111 @@ --- -ms.date: 06/09/2017 -schema: 2.0.0 -locale: en-us -keywords: powershell,cmdlet +external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml +keywords: powershell,cmdlet +locale: en-us +Module Name: Microsoft.PowerShell.Management +ms.date: 04/04/2019 online version: http://go.microsoft.com/fwlink/?LinkID=135246 -external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml -title: Remove-Computer +schema: 2.0.0 +title: Remove-Computer --- - # Remove-Computer + ## SYNOPSIS Removes the local computer from its domain. + ## SYNTAX ### Local (Default) + ``` -Remove-Computer [[-UnjoinDomainCredential] ] [-Restart] [-Force] [-PassThru] - [-Workgroup ] [-WhatIf] [-Confirm] [] +Remove-Computer [[-UnjoinDomainCredential] ] [-Restart] [-Force] [-PassThru] [-Workgroup ] [-WhatIf] [-Confirm] [] ``` ### Remote + ``` -Remove-Computer [-UnjoinDomainCredential] [-LocalCredential ] [-Restart] - [-ComputerName ] [-Force] [-PassThru] [-Workgroup ] [-WhatIf] [-Confirm] - [] +Remove-Computer -UnjoinDomainCredential [-LocalCredential ] [-Restart] [-ComputerName ] [-Force] [-PassThru] [-Workgroup ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION -The **Remove-Computer** cmdlet removes the local computer and remote computers from their current domains. -When you remove a computer from a domain, **Remove-Computer** also disables the computer's domain account. -You must provide explicit credentials to unjoin the computer from its domain, even when they are the credentials of the current user, and you must restart the computer to make the change effective. -Also, when you remove a computer from a domain, you must move it to a workgroup. -Use the **WorkgroupName** parameter to specify the workgroup. +The `Remove-Computer` cmdlet removes the local computer and remote computers from their current +domains. + +When you remove a computer from a domain, `Remove-Computer` also disables the domain account of the +computer. You must provide explicit credentials to unjoin the computer from its domain, even when +they are the credentials of the current user. You must restart the computer to make the change +effective. Also, when you remove a computer from a domain, you must move it to a workgroup. Use the +**WorkgroupName** parameter to specify the workgroup. -To move a computer from a workgroup to a domain, from one workgroup to another, or from one domain to another, use the Add-Computer cmdlet. +To move a computer from a workgroup to a domain, from one workgroup to another, or from one domain +to another, use the `Add-Computer` cmdlet. -To get the results of the command, use the **Verbose** and **PassThru** parameters. -To suppress the user prompt, use the **Force** parameter. +To get the results of the command, use the **Verbose** and **PassThru** parameters. To suppress the +user prompt, use the **Force** parameter. + +`Remove-Computer` removes the local computer and remote computers from domains. It includes +credential parameters that specify alternate credentials for connecting to remote computers, and +unjoining from a domain, a **Restart** parameter for restarting the affected computers, and a +**WorkgroupName** parameter for specifying the name of the workgroup to which computers are added. -Beginning in Windows PowerShell 3.0, **Remove-Computer** removes the local computer and remote computers from domains. -It includes new credential parameters that specify alternate credentials for connecting to remote computers, and unjoining from a domain, a new **Restart** parameter for restarting the affected computers, and a Workgroup parameter for specifying the name of the workgroup to which computers are added. ## EXAMPLES -### Example 1 -``` -PS C:\> Remove-Computer -UnjoinDomaincredential Domain01\Admin01 -Passthru -Verbose -Restart +### Example 1: Remove the local computer from its domain + +This example removes the local computer from the domain to which it is joined. + +```powershell +Remove-Computer -UnjoinDomaincredential Domain01\Admin01 -PassThru -Verbose -Restart ``` -This command removes the local computer from the domain to which it is joined. +The **UnjoinDomainCredential** parameter provides the credentials of a domain administrator. The +**PassThru** and the **Verbose** common parameters display information about the success or failure +of the command. The **Restart** parameter restarts the computer to complete the remove operation. -The command uses the **UnjoinDomainCredential** parameter to supply the credentials of a domain administrator. -It uses the **PassThru** parameter and the **Verbose** common parameter to display information about the success or failure of the command and the **Restart** parameter restart the computer, which is required to complete the remove operation. +When no workgroup name is specified, the computer is moved to the workgroup named after it is +removed from its domain. -Because the command does not specify a workgroup name, the local computer is moved to the "WORKGROUP" workgroup after it is removed from its domain. -### Example 2 -``` -PS C:\> Remove-Computer -ComputerName (Get-Content OldServers.txt) -LocalCredential Domain01\Admin01 -UnJoinDomainCredential Domain01\Admin01 -Workgroup Legacy -Force -Restart -``` +### Example 2: Move several computers to a legacy workgroup -This command removes all of the computers that are listed in the OldServers.txt file from their domains and places them in the Legacy workgroup. +This example removes all the computers listed in the `OldServers.txt` file from their +domains and moves them into the **Legacy** workgroup. -The command uses the **LocalCredential** parameter to supply the credentials of a user who has permission to connect to remote computers and the **UnjoinDomainCredential** parameter to supply the credentials of a user who has permission to remove the computers from their domains. -It uses the **Force** parameter to suppress the confirmation prompts for each computer and the **Restart** parameter to restart each of the computers after it is removed from its domain. -### Example 3 +```powershell +Remove-Computer -ComputerName (Get-Content OldServers.txt) -LocalCredential Domain01\Admin01 -UnJoinDomainCredential Domain01\Admin01 -Workgroup "Legacy" -Force -Restart ``` -PS C:\> Remove-Computer -ComputerName Server01, localhost -UnjoinDomainCredential Domain01\Admin01 -Workgroup Local -Restart -Force + +The **LocalCredential** parameter provides the credentials of a user who has permission to connect +to remote computers. The **UnjoinDomainCredential** parameter provides the credentials of a user who +has permission to remove the computers from their domains. The **Force** parameter suppresses the +confirmation prompts for each computer. The **Restart** parameter restarts each of the computers +after it is removed from its domain. + +### Example 3: Remove computers from a workgroup without confirmation + +This example removes the remote computer, Server01, and the local computer from their domains and +adds them to the **Local** workgroup. + +```powershell +Remove-Computer -ComputerName "Server01", "localhost" -UnjoinDomainCredential Domain01\Admin01 -Workgroup "Local" -Restart -Force ``` -This command removes the Server01 remote computer and the local computer from their domains and adds them to the Local workgroup. -It uses the **Force** parameter to suppress the confirmation prompt for each computer and the **Restart** parameter to restart the computers to make the change effective. +The **Force** parameter suppresses the confirmation prompt for each computer. The **Restart** +parameter restarts the computers to make the change effective. + ## PARAMETERS ### -ComputerName -Specifies the computers to be removed from their domains. -The default is the local computer. -Type the NetBIOS name, an Internet Protocol (IP) address, or a fully qualified domain name of the remote computers. -To specify the local computer, type the computer name, a dot (.), or "localhost". +Specifies the computers to be removed from their domains. The default is the local computer. -This parameter does not rely on Windows PowerShell remoting. -You can use the **ComputerName** parameter of **Remove-Computer** even if your computer is not configured to run remote commands. +Type the NetBIOS name, an IP address, or a fully qualified domain name (FQDN) of the remote +computers. To specify the local computer, type the computer name, a dot (.), or localhost. -This parameter is introduced in Windows PowerShell 3.0. +This parameter does not rely on PowerShell remoting. You can use the **ComputerName** +parameter of `Remove-Computer` even if your computer is not configured to run remote commands. + +This parameter was introduced in PowerShell 3.0. ```yaml Type: String[] @@ -91,14 +114,15 @@ Aliases: Required: False Position: Named -Default value: LLocal computer +Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` ### -Force -Suppresses the user prompt. -By default, **Remove-Computer** prompts you for confirmation before removing each computer. + +Suppresses the user prompt. By default, `Remove-Computer` prompts you for confirmation before +removing each computer. ```yaml Type: SwitchParameter @@ -107,21 +131,22 @@ Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -LocalCredential -Specifies a user account that has permission to connect to the computers that are specified by the **ComputerName** parameter. -The default is the current user. -Type a user name, such as "User01" or "Domain01\User01", or enter a **PSCredential** object, such as one generated by the Get-Credential cmdlet. -If you type a user name, you will be prompted for a password. +Specifies a user account that has permission to connect to the computers that the **ComputerName** +parameter specifies. The default is the current user. -To specify a user account that has permission to remove the computer from its current domain, use the **UnjoinDomainCredential** parameter. +Type a user name, such as `User01` or` Domain01\User01`, or enter a **PSCredential** object, such as +one generated by the `Get-Credential` cmdlet. If you type a user name, the cmdlet prompts you for a +password. To specify a user account that has permission to remove the computer from its current +domain, use the **UnjoinDomainCredential** parameter. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: PSCredential @@ -130,14 +155,14 @@ Aliases: Required: False Position: Named -Default value: Current user +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -PassThru -Returns the results of the command. -Otherwise, this cmdlet does not generate any output. + +Returns the results of the command. Otherwise, this cmdlet does not generate any output. ```yaml Type: SwitchParameter @@ -146,16 +171,17 @@ Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Restart -Restarts the computers that were removed after the removal is complete. -A restart is often required to make the change effective. -This parameter is introduced in Windows PowerShell 3.0. +Indicates that this cmdlet restarts the computers that are being removed. A restart is often +required to make the change effective. + +This parameter was introduced in PowerShell 3.0. ```yaml Type: SwitchParameter @@ -164,53 +190,44 @@ Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -UnjoinDomainCredential + Specifies a user account that has permission to remove the computers from their current domains. -Explicit credentials, as provided by this parameter, are required to remove remote computers from a domain, even when the value is the credentials of the current user. +Explicit credentials, as provided by this parameter, are required to remove remote computers from a +domain, even when the value is the credentials of the current user. -Type a user name, such as "User01" or "Domain01\User01", or enter a **PSCredential** object, such as one generated by the Get-Credential cmdlet. -If you type a user name, you will be prompted for a password. -You can refer to this parameter by its name, **UnjoinDomainCredential**, or its alias, **Credential**. +Type a user name, such as User01 or Domain01\User01, or enter a **PSCredential** object, such as one +generated by `Get-Credential`. If you type a user name, this cmdlet prompts you for a password. -To specify a user account that has permission to connect to the remote computers, use the **LocalCredential** parameter. +To specify a user account that has permission to connect to the remote computers, use the +**LocalCredential** parameter. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: PSCredential -Parameter Sets: Local +Parameter Sets: Local, Remote Aliases: Credential -Required: False -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -```yaml -Type: PSCredential -Parameter Sets: Remote -Aliases: Credential - -Required: True -Position: 1 +Required: False (Local), True (Remote) +Position: 0 Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Workgroup -Specifies the name of a workgroup to which the computers are added when they are removed from their domains. -The default value is "WORKGROUP". -When you remove a computer from a domain, you must add it to a workgroup. -This parameter is introduced in Windows PowerShell 3.0. +Specifies the name of a workgroup to which the computers are added when they are removed from their +domains. The default value is **WORKGROUP**. When you remove a computer from a domain, you must add +it to a workgroup. + +This parameter was introduced in PowerShell 3.0. ```yaml Type: String @@ -219,12 +236,13 @@ Aliases: Required: False Position: Named -Default value: WORKGROUP +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Confirm + Prompts you for confirmation before running the cmdlet. ```yaml @@ -234,14 +252,14 @@ Aliases: cf Required: False Position: Named -Default value: None +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` ### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. + +Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml Type: SwitchParameter @@ -250,24 +268,34 @@ Aliases: wi Required: False Position: Named -Default value: None +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + ## INPUTS ### System.String -You can pipe computer names to the **Remove-Computer** cmdlet. + +You can pipe computer names to thiscmdlet. + ## OUTPUTS ### Microsoft.PowerShell.Commands.ComputerChangeInfo -When you use the **PassThru** parameter, **Remove-Computer** returns a **ComputerChangeInfo** object. + +When you use the **PassThru** parameter, `Remove-Computer` returns a **ComputerChangeInfo** object. Otherwise, this cmdlet does not generate any output. + ## NOTES -* This cmdlet does not remove computers from workgroups. + +This cmdlet does not remove computers from workgroups. + ## RELATED LINKS [Add-Computer](Add-Computer.md) diff --git a/reference/4.0/Microsoft.PowerShell.Management/Remove-Computer.md b/reference/4.0/Microsoft.PowerShell.Management/Remove-Computer.md index b200bac38fba..7b4dbf8002c4 100644 --- a/reference/4.0/Microsoft.PowerShell.Management/Remove-Computer.md +++ b/reference/4.0/Microsoft.PowerShell.Management/Remove-Computer.md @@ -1,13 +1,13 @@ --- -ms.date: 06/09/2017 -schema: 2.0.0 -locale: en-us -keywords: powershell,cmdlet +external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml +keywords: powershell,cmdlet +locale: en-us +Module Name: Microsoft.PowerShell.Management +ms.date: 04/04/2019 online version: http://go.microsoft.com/fwlink/p/?linkid=293894 -external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml -title: Remove-Computer +schema: 2.0.0 +title: Remove-Computer --- - # Remove-Computer ## SYNOPSIS @@ -16,79 +16,99 @@ Removes the local computer from its domain. ## SYNTAX ### Local (Default) + ``` Remove-Computer [[-UnjoinDomainCredential] ] [-Restart] [-Force] [-PassThru] [-WorkgroupName ] [-WhatIf] [-Confirm] [] ``` ### Remote + ``` -Remove-Computer [-UnjoinDomainCredential] [-LocalCredential ] [-Restart] +Remove-Computer -UnjoinDomainCredential [-LocalCredential ] [-Restart] [-ComputerName ] [-Force] [-PassThru] [-WorkgroupName ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION -The **Remove-Computer** cmdlet removes the local computer and remote computers from their current domains. -When you remove a computer from a domain, **Remove-Computer** also disables the computer's domain account. -You must provide explicit credentials to unjoin the computer from its domain, even when they are the credentials of the current user, and you must restart the computer to make the change effective. -Also, when you remove a computer from a domain, you must move it to a workgroup. -Use the **WorkgroupName** parameter to specify the workgroup. +The `Remove-Computer` cmdlet removes the local computer and remote computers from their current +domains. -To move a computer from a workgroup to a domain, from one workgroup to another, or from one domain to another, use the Add-Computer cmdlet. +When you remove a computer from a domain, `Remove-Computer` also disables the domain account of the +computer. You must provide explicit credentials to unjoin the computer from its domain, even when +they are the credentials of the current user. You must restart the computer to make the change +effective. Also, when you remove a computer from a domain, you must move it to a workgroup. Use the +**WorkgroupName** parameter to specify the workgroup. -To get the results of the command, use the **Verbose** and **PassThru** parameters. -To suppress the user prompt, use the **Force** parameter. +To move a computer from a workgroup to a domain, from one workgroup to another, or from one domain +to another, use the `Add-Computer` cmdlet. -**Remove-Computer** removes the local computer and remote computers from domains. -It includes credential parameters that specify alternate credentials for connecting to remote computers, and unjoining from a domain, a **Restart** parameter for restarting the affected computers, and a **WorkgroupName** parameter for specifying the name of the workgroup to which computers are added. +To get the results of the command, use the **Verbose** and **PassThru** parameters. To suppress the +user prompt, use the **Force** parameter. + +`Remove-Computer` removes the local computer and remote computers from domains. It includes +credential parameters that specify alternate credentials for connecting to remote computers, and +unjoining from a domain, a **Restart** parameter for restarting the affected computers, and a +**WorkgroupName** parameter for specifying the name of the workgroup to which computers are added. ## EXAMPLES -### Example 1 -``` -PS C:\> Remove-Computer -UnjoinDomaincredential Domain01\Admin01 -Passthru -Verbose -Restart +### Example 1: Remove the local computer from its domain + +This example removes the local computer from the domain to which it is joined. + +```powershell +Remove-Computer -UnjoinDomaincredential Domain01\Admin01 -PassThru -Verbose -Restart ``` -This command removes the local computer from the domain to which it is joined. +The **UnjoinDomainCredential** parameter provides the credentials of a domain administrator. The +**PassThru** and the **Verbose** common parameters display information about the success or failure +of the command. The **Restart** parameter restarts the computer to complete the remove operation. -The command uses the **UnjoinDomainCredential** parameter to supply the credentials of a domain administrator. -It uses the **PassThru** parameter and the **Verbose** common parameter to display information about the success or failure of the command and the **Restart** parameter restart the computer, which is required to complete the remove operation. +When no workgroup name is specified, the computer is moved to the workgroup named after it is +removed from its domain. -Because the command does not specify a workgroup name, the local computer is moved to the "WORKGROUP" workgroup after it is removed from its domain. +### Example 2: Move several computers to a legacy workgroup -### Example 2 -``` -PS C:\> Remove-Computer -ComputerName (Get-Content OldServers.txt) -LocalCredential Domain01\Admin01 -UnJoinDomainCredential Domain01\Admin01 -WorkgroupName Legacy -Force -Restart +This example removes all the computers listed in the `OldServers.txt` file from their +domains and moves them into the **Legacy** workgroup. + +```powershell +Remove-Computer -ComputerName (Get-Content OldServers.txt) -LocalCredential Domain01\Admin01 -UnJoinDomainCredential Domain01\Admin01 -WorkgroupName "Legacy" -Force -Restart ``` -This command removes all of the computers that are listed in the OldServers.txt file from their domains and places them in the Legacy workgroup. +The **LocalCredential** parameter provides the credentials of a user who has permission to connect +to remote computers. The **UnjoinDomainCredential** parameter provides the credentials of a user who +has permission to remove the computers from their domains. The **Force** parameter suppresses the +confirmation prompts for each computer. The **Restart** parameter restarts each of the computers +after it is removed from its domain. -The command uses the **LocalCredential** parameter to supply the credentials of a user who has permission to connect to remote computers and the **UnjoinDomainCredential** parameter to supply the credentials of a user who has permission to remove the computers from their domains. -It uses the **Force** parameter to suppress the confirmation prompts for each computer and the **Restart** parameter to restart each of the computers after it is removed from its domain. +### Example 3: Remove computers from a workgroup without confirmation -### Example 3 -``` -PS C:\> Remove-Computer -ComputerName Server01, localhost -UnjoinDomainCredential Domain01\Admin01 -WorkgroupName Local -Restart -Force +This example removes the remote computer, Server01, and the local computer from their domains and +adds them to the **Local** workgroup. + +```powershell +Remove-Computer -ComputerName "Server01", "localhost" -UnjoinDomainCredential Domain01\Admin01 -WorkgroupName "Local" -Restart -Force ``` -This command removes the Server01 remote computer and the local computer from their domains and adds them to the Local workgroup. -It uses the **Force** parameter to suppress the confirmation prompt for each computer and the **Restart** parameter to restart the computers to make the change effective. +The **Force** parameter suppresses the confirmation prompt for each computer. The **Restart** +parameter restarts the computers to make the change effective. ## PARAMETERS ### -ComputerName -Specifies the computers to be removed from their domains. -The default is the local computer. -Type the NetBIOS name, an Internet Protocol (IP) address, or a fully qualified domain name of the remote computers. -To specify the local computer, type the computer name, a dot (.), or "localhost". +Specifies the computers to be removed from their domains. The default is the local computer. -This parameter does not rely on Windows PowerShell remoting. -You can use the **ComputerName** parameter of **Remove-Computer** even if your computer is not configured to run remote commands. +Type the NetBIOS name, an IP address, or a fully qualified domain name (FQDN) of the remote +computers. To specify the local computer, type the computer name, a dot (.), or localhost. -This parameter is introduced in Windows PowerShell 3.0. +This parameter does not rely on PowerShell remoting. You can use the **ComputerName** +parameter of `Remove-Computer` even if your computer is not configured to run remote commands. + +This parameter was introduced in PowerShell 3.0. ```yaml Type: String[] @@ -97,14 +117,15 @@ Aliases: Required: False Position: Named -Default value: Local computer +Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` ### -Force -Suppresses the user prompt. -By default, **Remove-Computer** prompts you for confirmation before removing each computer. + +Suppresses the user prompt. By default, `Remove-Computer` prompts you for confirmation before +removing each computer. ```yaml Type: SwitchParameter @@ -113,21 +134,22 @@ Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -LocalCredential -Specifies a user account that has permission to connect to the computers that are specified by the **ComputerName** parameter. -The default is the current user. -Type a user name, such as "User01" or "Domain01\User01", or enter a **PSCredential** object, such as one generated by the Get-Credential cmdlet. -If you type a user name, you will be prompted for a password. +Specifies a user account that has permission to connect to the computers that the **ComputerName** +parameter specifies. The default is the current user. -To specify a user account that has permission to remove the computer from its current domain, use the **UnjoinDomainCredential** parameter. +Type a user name, such as `User01` or` Domain01\User01`, or enter a **PSCredential** object, such as +one generated by the `Get-Credential` cmdlet. If you type a user name, the cmdlet prompts you for a +password. To specify a user account that has permission to remove the computer from its current +domain, use the **UnjoinDomainCredential** parameter. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: PSCredential @@ -136,14 +158,14 @@ Aliases: Required: False Position: Named -Default value: Current user +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -PassThru -Returns the results of the command. -Otherwise, this cmdlet does not generate any output. + +Returns the results of the command. Otherwise, this cmdlet does not generate any output. ```yaml Type: SwitchParameter @@ -152,16 +174,17 @@ Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Restart -Restarts the computers that were removed after the removal is complete. -A restart is often required to make the change effective. -This parameter is introduced in Windows PowerShell 3.0. +Indicates that this cmdlet restarts the computers that are being removed. A restart is often +required to make the change effective. + +This parameter was introduced in PowerShell 3.0. ```yaml Type: SwitchParameter @@ -170,53 +193,44 @@ Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -UnjoinDomainCredential -Specifies a user account that has permission to remove the computers from their current domains. -Explicit credentials, as provided by this parameter, are required to remove remote computers from a domain, even when the value is the credentials of the current user. -Type a user name, such as "User01" or "Domain01\User01", or enter a **PSCredential** object, such as one generated by the Get-Credential cmdlet. -If you type a user name, you will be prompted for a password. -You can refer to this parameter by its name, **UnjoinDomainCredential**, or its alias, **Credential**. +Specifies a user account that has permission to remove the computers from their current domains. +Explicit credentials, as provided by this parameter, are required to remove remote computers from a +domain, even when the value is the credentials of the current user. -To specify a user account that has permission to connect to the remote computers, use the **LocalCredential** parameter. +Type a user name, such as User01 or Domain01\User01, or enter a **PSCredential** object, such as one +generated by `Get-Credential`. If you type a user name, this cmdlet prompts you for a password. -This parameter is introduced in Windows PowerShell 3.0. +To specify a user account that has permission to connect to the remote computers, use the +**LocalCredential** parameter. -```yaml -Type: PSCredential -Parameter Sets: Local -Aliases: Credential - -Required: False -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` +This parameter was introduced in PowerShell 3.0. ```yaml Type: PSCredential -Parameter Sets: Remote +Parameter Sets: Local, Remote Aliases: Credential -Required: True -Position: 1 +Required: False (Local), True (Remote) +Position: 0 Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -WorkgroupName -Specifies the name of a workgroup to which the computers are added when they are removed from their domains. -The default value is "WORKGROUP". -When you remove a computer from a domain, you must add it to a workgroup. -This parameter is introduced in Windows PowerShell 3.0. +Specifies the name of a workgroup to which the computers are added when they are removed from their +domains. The default value is **WORKGROUP**. When you remove a computer from a domain, you must add +it to a workgroup. + +This parameter was introduced in PowerShell 3.0. ```yaml Type: String @@ -225,12 +239,13 @@ Aliases: Required: False Position: Named -Default value: WORKGROUP +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Confirm + Prompts you for confirmation before running the cmdlet. ```yaml @@ -246,8 +261,8 @@ Accept wildcard characters: False ``` ### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. + +Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml Type: SwitchParameter @@ -262,21 +277,27 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS ### System.String -You can pipe computer names to the **Remove-Computer** cmdlet. + +You can pipe computer names to thiscmdlet. ## OUTPUTS ### Microsoft.PowerShell.Commands.ComputerChangeInfo -When you use the **PassThru** parameter, **Remove-Computer** returns a **ComputerChangeInfo** object. + +When you use the **PassThru** parameter, `Remove-Computer` returns a **ComputerChangeInfo** object. Otherwise, this cmdlet does not generate any output. ## NOTES -* This cmdlet does not remove computers from workgroups. + +This cmdlet does not remove computers from workgroups. ## RELATED LINKS diff --git a/reference/5.0/Microsoft.PowerShell.Management/Remove-Computer.md b/reference/5.0/Microsoft.PowerShell.Management/Remove-Computer.md index 3e2158396a0a..7eda5f420fb6 100644 --- a/reference/5.0/Microsoft.PowerShell.Management/Remove-Computer.md +++ b/reference/5.0/Microsoft.PowerShell.Management/Remove-Computer.md @@ -1,11 +1,12 @@ --- -ms.date: 06/09/2017 -schema: 2.0.0 -locale: en-us -keywords: powershell,cmdlet -online version: http://go.microsoft.com/fwlink/?LinkId=821614 -external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml -title: Remove-Computer +external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml +keywords: powershell,cmdlet +locale: en-us +Module Name: Microsoft.PowerShell.Management +ms.date: 04/04/2019 +online version: http://go.microsoft.com/fwlink/?LinkId=821614 +schema: 2.0.0 +title: Remove-Computer --- # Remove-Computer @@ -17,7 +18,7 @@ Removes the local computer from its domain. ### Local (Default) ``` -Remove-Computer [-UnjoinDomainCredential ] [-Restart] [-Force] [-PassThru] +Remove-Computer [[-UnjoinDomainCredential] ] [-Restart] [-Force] [-PassThru] [-WorkgroupName ] [-WhatIf] [-Confirm] [] ``` @@ -31,71 +32,83 @@ Remove-Computer -UnjoinDomainCredential [-LocalCredential Remove-Computer -UnjoinDomaincredential Domain01\Admin01 -PassThru -Verbose -Restart -``` +This example removes the local computer from the domain to which it is joined. -This command removes the local computer from the domain to which it is joined. +```powershell +Remove-Computer -UnjoinDomaincredential Domain01\Admin01 -PassThru -Verbose -Restart +``` -The command uses the *UnjoinDomainCredential* parameter to supply the credentials of a domain administrator. -It uses the *PassThru* parameter and the *Verbose* common parameter to display information about the success or failure of the command and the *Restart* parameter restart the computer, which is required to complete the remove operation. +The **UnjoinDomainCredential** parameter provides the credentials of a domain administrator. The +**PassThru** and the **Verbose** common parameters display information about the success or failure +of the command. The **Restart** parameter restarts the computer to complete the remove operation. -Because the command does not specify a workgroup name, the local computer is moved to the WORKGROUP workgroup after it is removed from its domain. +When no workgroup name is specified, the computer is moved to the workgroup named after it is +removed from its domain. ### Example 2: Move several computers to a legacy workgroup -``` -PS C:\> Remove-Computer -ComputerName (Get-Content OldServers.txt) -LocalCredential Domain01\Admin01 -UnJoinDomainCredential Domain01\Admin01 -WorkgroupName "Legacy" -Force -Restart -``` +This example removes all the computers listed in the `OldServers.txt` file from their +domains and moves them into the **Legacy** workgroup. -This command removes all of the computers that are listed in the OldServers.txt file from their domains and includes them in the Legacy workgroup. +```powershell +Remove-Computer -ComputerName (Get-Content OldServers.txt) -LocalCredential Domain01\Admin01 -UnJoinDomainCredential Domain01\Admin01 -WorkgroupName "Legacy" -Force -Restart +``` -The command uses the *LocalCredential* parameter to supply the credentials of a user who has permission to connect to remote computers and the *UnjoinDomainCredential* parameter to supply the credentials of a user who has permission to remove the computers from their domains. -It uses the *Force* parameter to suppress the confirmation prompts for each computer and the *Restart* parameter to restart each of the computers after it is removed from its domain. +The **LocalCredential** parameter provides the credentials of a user who has permission to connect +to remote computers. The **UnjoinDomainCredential** parameter provides the credentials of a user who +has permission to remove the computers from their domains. The **Force** parameter suppresses the +confirmation prompts for each computer. The **Restart** parameter restarts each of the computers +after it is removed from its domain. ### Example 3: Remove computers from a workgroup without confirmation -``` -PS C:\> Remove-Computer -ComputerName "Server01", "localhost" -UnjoinDomainCredential Domain01\Admin01 -WorkgroupName "Local" -Restart -Force +This example removes the remote computer, Server01, and the local computer from their domains and +adds them to the **Local** workgroup. + +```powershell +Remove-Computer -ComputerName "Server01", "localhost" -UnjoinDomainCredential Domain01\Admin01 -WorkgroupName "Local" -Restart -Force ``` -This command removes the Server01 remote computer and the local computer from their domains and adds them to the Local workgroup. -It uses the *Force* parameter to suppress the confirmation prompt for each computer and the *Restart* parameter to restart the computers to make the change effective. +The **Force** parameter suppresses the confirmation prompt for each computer. The **Restart** +parameter restarts the computers to make the change effective. ## PARAMETERS ### -ComputerName -Specifies the computers to be removed from their domains. -The default is the local computer. +Specifies the computers to be removed from their domains. The default is the local computer. -Type the NetBIOS name, an IP address, or a fully qualified domain name of the remote computers. -To specify the local computer, type the computer name, a dot (.), or localhost. +Type the NetBIOS name, an IP address, or a fully qualified domain name (FQDN) of the remote +computers. To specify the local computer, type the computer name, a dot (.), or localhost. -This parameter does not rely on Windows PowerShell remoting. -You can use the *ComputerName* parameter of **Remove-Computer** even if your computer is not configured to run remote commands. +This parameter does not rely on PowerShell remoting. You can use the **ComputerName** +parameter of `Remove-Computer` even if your computer is not configured to run remote commands. -This parameter was introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: String[] @@ -109,26 +122,10 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -Confirm - -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Force -Suppresses the user prompt. -By default, **Remove-Computer** prompts you for confirmation before removing each computer. +Suppresses the user prompt. By default, `Remove-Computer` prompts you for confirmation before +removing each computer. ```yaml Type: SwitchParameter @@ -144,14 +141,15 @@ Accept wildcard characters: False ### -LocalCredential -Specifies a user account that has permission to connect to the computers that the *ComputerName* parameter specifies. -The default is the current user. +Specifies a user account that has permission to connect to the computers that the **ComputerName** +parameter specifies. The default is the current user. -Type a user name, such as User01 or Domain01\User01, or enter a **PSCredential** object, such as one generated by the Get-Credential cmdlet. -If you type a user name, this cmdlet prompts you for a password. -To specify a user account that has permission to remove the computer from its current domain, use the *UnjoinDomainCredential* parameter. +Type a user name, such as `User01` or` Domain01\User01`, or enter a **PSCredential** object, such as +one generated by the `Get-Credential` cmdlet. If you type a user name, the cmdlet prompts you for a +password. To specify a user account that has permission to remove the computer from its current +domain, use the **UnjoinDomainCredential** parameter. -This parameter was introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: PSCredential @@ -167,8 +165,7 @@ Accept wildcard characters: False ### -PassThru -Returns the results of the command. -Otherwise, this cmdlet does not generate any output. +Returns the results of the command. Otherwise, this cmdlet does not generate any output. ```yaml Type: SwitchParameter @@ -184,10 +181,10 @@ Accept wildcard characters: False ### -Restart -Indicates that this cmdlet restarts the computers that were removed after the removal is completed. -A restart is often required to make the change effective. +Indicates that this cmdlet restarts the computers that are being removed. A restart is often +required to make the change effective. -This parameter was introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: SwitchParameter @@ -204,50 +201,57 @@ Accept wildcard characters: False ### -UnjoinDomainCredential Specifies a user account that has permission to remove the computers from their current domains. -Explicit credentials, as provided by this parameter, are required to remove remote computers from a domain, even when the value is the credentials of the current user. - -Type a user name, such as User01 or Domain01\User01, or enter a **PSCredential** object, such as one generated by **Get-Credential**. -If you type a user name, this cmdlet prompts you for a password. +Explicit credentials, as provided by this parameter, are required to remove remote computers from a +domain, even when the value is the credentials of the current user. -You can refer to this parameter by its name, *UnjoinDomainCredential*, or its alias, *Credential*. +Type a user name, such as User01 or Domain01\User01, or enter a **PSCredential** object, such as one +generated by `Get-Credential`. If you type a user name, this cmdlet prompts you for a password. -To specify a user account that has permission to connect to the remote computers, use the *LocalCredential* parameter. +To specify a user account that has permission to connect to the remote computers, use the +**LocalCredential** parameter. -This parameter was introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: PSCredential -Parameter Sets: Local +Parameter Sets: Local, Remote Aliases: Credential -Required: False -Position: Named +Required: False (Local), True (Remote) +Position: 0 Default value: None Accept pipeline input: False Accept wildcard characters: False ``` +### -WorkgroupName + +Specifies the name of a workgroup to which the computers are added when they are removed from their +domains. The default value is **WORKGROUP**. When you remove a computer from a domain, you must add +it to a workgroup. + +This parameter was introduced in PowerShell 3.0. + ```yaml -Type: PSCredential -Parameter Sets: Remote -Aliases: Credential +Type: String +Parameter Sets: (All) +Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -WhatIf +### -Confirm -Shows what would happen if the cmdlet runs. -The cmdlet is not run. +Prompts you for confirmation before running the cmdlet. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: wi +Aliases: cf Required: False Position: Named @@ -256,29 +260,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -WorkgroupName - -Specifies the name of a workgroup to which the computers are added when they are removed from their domains. -The default value is WORKGROUP. -When you remove a computer from a domain, you must add it to a workgroup. +### -WhatIf -This parameter was introduced in Windows PowerShell 3.0. +Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml -Type: String +Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: wi Required: False Position: Named -Default value: None +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS @@ -290,12 +292,12 @@ You can pipe computer names to thiscmdlet. ### Microsoft.PowerShell.Commands.ComputerChangeInfo -When you use the *PassThru* parameter, **Remove-Computer** returns a **ComputerChangeInfo** object. +When you use the **PassThru** parameter, `Remove-Computer` returns a **ComputerChangeInfo** object. Otherwise, this cmdlet does not generate any output. ## NOTES -* This cmdlet does not remove computers from workgroups. +This cmdlet does not remove computers from workgroups. ## RELATED LINKS diff --git a/reference/5.1/Microsoft.PowerShell.Management/Remove-Computer.md b/reference/5.1/Microsoft.PowerShell.Management/Remove-Computer.md index 8f9f870a7ad3..7eda5f420fb6 100644 --- a/reference/5.1/Microsoft.PowerShell.Management/Remove-Computer.md +++ b/reference/5.1/Microsoft.PowerShell.Management/Remove-Computer.md @@ -3,12 +3,11 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml keywords: powershell,cmdlet locale: en-us Module Name: Microsoft.PowerShell.Management -ms.date: 06/09/2017 +ms.date: 04/04/2019 online version: http://go.microsoft.com/fwlink/?LinkId=821614 schema: 2.0.0 title: Remove-Computer --- - # Remove-Computer ## SYNOPSIS @@ -17,80 +16,99 @@ Removes the local computer from its domain. ## SYNTAX ### Local (Default) + ``` Remove-Computer [[-UnjoinDomainCredential] ] [-Restart] [-Force] [-PassThru] [-WorkgroupName ] [-WhatIf] [-Confirm] [] ``` ### Remote + ``` -Remove-Computer [-UnjoinDomainCredential] [-LocalCredential ] [-Restart] +Remove-Computer -UnjoinDomainCredential [-LocalCredential ] [-Restart] [-ComputerName ] [-Force] [-PassThru] [-WorkgroupName ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION -The **Remove-Computer** cmdlet removes the local computer and remote computers from their current domains. -When you remove a computer from a domain, **Remove-Computer** also disables the domain account of the computer. -You must provide explicit credentials to unjoin the computer from its domain, even when they are the credentials of the current user. -You must restart the computer to make the change effective. -Also, when you remove a computer from a domain, you must move it to a workgroup. -Use the *WorkgroupName* parameter to specify the workgroup. +The `Remove-Computer` cmdlet removes the local computer and remote computers from their current +domains. -To move a computer from a workgroup to a domain, from one workgroup to another, or from one domain to another, use the Add-Computer cmdlet. +When you remove a computer from a domain, `Remove-Computer` also disables the domain account of the +computer. You must provide explicit credentials to unjoin the computer from its domain, even when +they are the credentials of the current user. You must restart the computer to make the change +effective. Also, when you remove a computer from a domain, you must move it to a workgroup. Use the +**WorkgroupName** parameter to specify the workgroup. -To get the results of the command, use the *Verbose* and *PassThru* parameters. -To suppress the user prompt, use the *Force* parameter. +To move a computer from a workgroup to a domain, from one workgroup to another, or from one domain +to another, use the `Add-Computer` cmdlet. -**Remove-Computer** removes the local computer and remote computers from domains. -It includes credential parameters that specify alternate credentials for connecting to remote computers, and unjoining from a domain, a *Restart* parameter for restarting the affected computers, and a *WorkgroupName* parameter for specifying the name of the workgroup to which computers are added. +To get the results of the command, use the **Verbose** and **PassThru** parameters. To suppress the +user prompt, use the **Force** parameter. + +`Remove-Computer` removes the local computer and remote computers from domains. It includes +credential parameters that specify alternate credentials for connecting to remote computers, and +unjoining from a domain, a **Restart** parameter for restarting the affected computers, and a +**WorkgroupName** parameter for specifying the name of the workgroup to which computers are added. ## EXAMPLES ### Example 1: Remove the local computer from its domain -``` -PS C:\> Remove-Computer -UnjoinDomaincredential Domain01\Admin01 -PassThru -Verbose -Restart -``` -This command removes the local computer from the domain to which it is joined. +This example removes the local computer from the domain to which it is joined. -The command uses the *UnjoinDomainCredential* parameter to supply the credentials of a domain administrator. -It uses the *PassThru* parameter and the *Verbose* common parameter to display information about the success or failure of the command and the *Restart* parameter restart the computer, which is required to complete the remove operation. +```powershell +Remove-Computer -UnjoinDomaincredential Domain01\Admin01 -PassThru -Verbose -Restart +``` + +The **UnjoinDomainCredential** parameter provides the credentials of a domain administrator. The +**PassThru** and the **Verbose** common parameters display information about the success or failure +of the command. The **Restart** parameter restarts the computer to complete the remove operation. -Because the command does not specify a workgroup name, the local computer is moved to the WORKGROUP workgroup after it is removed from its domain. +When no workgroup name is specified, the computer is moved to the workgroup named after it is +removed from its domain. ### Example 2: Move several computers to a legacy workgroup -``` -PS C:\> Remove-Computer -ComputerName (Get-Content OldServers.txt) -LocalCredential Domain01\Admin01 -UnJoinDomainCredential Domain01\Admin01 -WorkgroupName "Legacy" -Force -Restart -``` -This command removes all of the computers that are listed in the OldServers.txt file from their domains and includes them in the Legacy workgroup. +This example removes all the computers listed in the `OldServers.txt` file from their +domains and moves them into the **Legacy** workgroup. -The command uses the *LocalCredential* parameter to supply the credentials of a user who has permission to connect to remote computers and the *UnjoinDomainCredential* parameter to supply the credentials of a user who has permission to remove the computers from their domains. -It uses the *Force* parameter to suppress the confirmation prompts for each computer and the *Restart* parameter to restart each of the computers after it is removed from its domain. +```powershell +Remove-Computer -ComputerName (Get-Content OldServers.txt) -LocalCredential Domain01\Admin01 -UnJoinDomainCredential Domain01\Admin01 -WorkgroupName "Legacy" -Force -Restart +``` + +The **LocalCredential** parameter provides the credentials of a user who has permission to connect +to remote computers. The **UnjoinDomainCredential** parameter provides the credentials of a user who +has permission to remove the computers from their domains. The **Force** parameter suppresses the +confirmation prompts for each computer. The **Restart** parameter restarts each of the computers +after it is removed from its domain. ### Example 3: Remove computers from a workgroup without confirmation -``` -PS C:\> Remove-Computer -ComputerName "Server01", "localhost" -UnjoinDomainCredential Domain01\Admin01 -WorkgroupName "Local" -Restart -Force + +This example removes the remote computer, Server01, and the local computer from their domains and +adds them to the **Local** workgroup. + +```powershell +Remove-Computer -ComputerName "Server01", "localhost" -UnjoinDomainCredential Domain01\Admin01 -WorkgroupName "Local" -Restart -Force ``` -This command removes the Server01 remote computer and the local computer from their domains and adds them to the Local workgroup. -It uses the *Force* parameter to suppress the confirmation prompt for each computer and the *Restart* parameter to restart the computers to make the change effective. +The **Force** parameter suppresses the confirmation prompt for each computer. The **Restart** +parameter restarts the computers to make the change effective. ## PARAMETERS ### -ComputerName -Specifies the computers to be removed from their domains. -The default is the local computer. -Type the NetBIOS name, an IP address, or a fully qualified domain name of the remote computers. -To specify the local computer, type the computer name, a dot (.), or localhost. +Specifies the computers to be removed from their domains. The default is the local computer. + +Type the NetBIOS name, an IP address, or a fully qualified domain name (FQDN) of the remote +computers. To specify the local computer, type the computer name, a dot (.), or localhost. -This parameter does not rely on Windows PowerShell remoting. -You can use the *ComputerName* parameter of **Remove-Computer** even if your computer is not configured to run remote commands. +This parameter does not rely on PowerShell remoting. You can use the **ComputerName** +parameter of `Remove-Computer` even if your computer is not configured to run remote commands. -This parameter was introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: String[] @@ -105,8 +123,9 @@ Accept wildcard characters: False ``` ### -Force -Suppresses the user prompt. -By default, **Remove-Computer** prompts you for confirmation before removing each computer. + +Suppresses the user prompt. By default, `Remove-Computer` prompts you for confirmation before +removing each computer. ```yaml Type: SwitchParameter @@ -121,14 +140,16 @@ Accept wildcard characters: False ``` ### -LocalCredential -Specifies a user account that has permission to connect to the computers that the *ComputerName* parameter specifies. -The default is the current user. -Type a user name, such as User01 or Domain01\User01, or enter a **PSCredential** object, such as one generated by the Get-Credential cmdlet. -If you type a user name, this cmdlet prompts you for a password. -To specify a user account that has permission to remove the computer from its current domain, use the *UnjoinDomainCredential* parameter. +Specifies a user account that has permission to connect to the computers that the **ComputerName** +parameter specifies. The default is the current user. + +Type a user name, such as `User01` or` Domain01\User01`, or enter a **PSCredential** object, such as +one generated by the `Get-Credential` cmdlet. If you type a user name, the cmdlet prompts you for a +password. To specify a user account that has permission to remove the computer from its current +domain, use the **UnjoinDomainCredential** parameter. -This parameter was introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: PSCredential @@ -143,8 +164,8 @@ Accept wildcard characters: False ``` ### -PassThru -Returns the results of the command. -Otherwise, this cmdlet does not generate any output. + +Returns the results of the command. Otherwise, this cmdlet does not generate any output. ```yaml Type: SwitchParameter @@ -159,10 +180,11 @@ Accept wildcard characters: False ``` ### -Restart -Indicates that this cmdlet restarts the computers that were removed after the removal is completed. -A restart is often required to make the change effective. -This parameter was introduced in Windows PowerShell 3.0. +Indicates that this cmdlet restarts the computers that are being removed. A restart is often +required to make the change effective. + +This parameter was introduced in PowerShell 3.0. ```yaml Type: SwitchParameter @@ -177,36 +199,25 @@ Accept wildcard characters: False ``` ### -UnjoinDomainCredential -Specifies a user account that has permission to remove the computers from their current domains. -Explicit credentials, as provided by this parameter, are required to remove remote computers from a domain, even when the value is the credentials of the current user. -Type a user name, such as User01 or Domain01\User01, or enter a **PSCredential** object, such as one generated by **Get-Credential**. -If you type a user name, this cmdlet prompts you for a password. +Specifies a user account that has permission to remove the computers from their current domains. +Explicit credentials, as provided by this parameter, are required to remove remote computers from a +domain, even when the value is the credentials of the current user. -You can refer to this parameter by its name, *UnjoinDomainCredential*, or its alias, *Credential*. +Type a user name, such as User01 or Domain01\User01, or enter a **PSCredential** object, such as one +generated by `Get-Credential`. If you type a user name, this cmdlet prompts you for a password. -To specify a user account that has permission to connect to the remote computers, use the *LocalCredential* parameter. +To specify a user account that has permission to connect to the remote computers, use the +**LocalCredential** parameter. -This parameter was introduced in Windows PowerShell 3.0. +This parameter was introduced in PowerShell 3.0. ```yaml Type: PSCredential -Parameter Sets: Local +Parameter Sets: Local, Remote Aliases: Credential -Required: False -Position: 0 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -```yaml -Type: PSCredential -Parameter Sets: Remote -Aliases: Credential - -Required: True +Required: False (Local), True (Remote) Position: 0 Default value: None Accept pipeline input: False @@ -214,11 +225,12 @@ Accept wildcard characters: False ``` ### -WorkgroupName -Specifies the name of a workgroup to which the computers are added when they are removed from their domains. -The default value is WORKGROUP. -When you remove a computer from a domain, you must add it to a workgroup. -This parameter was introduced in Windows PowerShell 3.0. +Specifies the name of a workgroup to which the computers are added when they are removed from their +domains. The default value is **WORKGROUP**. When you remove a computer from a domain, you must add +it to a workgroup. + +This parameter was introduced in PowerShell 3.0. ```yaml Type: String @@ -233,6 +245,7 @@ Accept wildcard characters: False ``` ### -Confirm + Prompts you for confirmation before running the cmdlet. ```yaml @@ -248,8 +261,8 @@ Accept wildcard characters: False ``` ### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. + +Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml Type: SwitchParameter @@ -264,21 +277,27 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS ### System.String + You can pipe computer names to thiscmdlet. ## OUTPUTS ### Microsoft.PowerShell.Commands.ComputerChangeInfo -When you use the *PassThru* parameter, **Remove-Computer** returns a **ComputerChangeInfo** object. + +When you use the **PassThru** parameter, `Remove-Computer` returns a **ComputerChangeInfo** object. Otherwise, this cmdlet does not generate any output. ## NOTES -* This cmdlet does not remove computers from workgroups. + +This cmdlet does not remove computers from workgroups. ## RELATED LINKS