Remove-Computer
Removes the local computer from its ___domain.
구문
Local (기본값)
Remove-Computer
[[-UnjoinDomainCredential] <PSCredential>]
[-Restart]
[-Force]
[-PassThru]
[-WorkgroupName <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remote
Remove-Computer
-UnjoinDomainCredential <PSCredential>
[-LocalCredential <PSCredential>]
[-Restart]
[-ComputerName <String[]>]
[-Force]
[-PassThru]
[-WorkgroupName <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
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.
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.
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.
예제
Example 1: Remove the local computer from its ___domain
This example removes the local computer from the ___domain to which it is joined.
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.
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
This example removes all the computers listed in the OldServers.txt
file from their domains and
moves them into the Legacy workgroup.
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
This example removes the remote computer, Server01, and the local computer from their domains and adds them to the Local workgroup.
Remove-Computer -ComputerName "Server01", "localhost" -UnjoinDomainCredential Domain01\Admin01 -WorkgroupName "Local" -Restart -Force
The Force parameter suppresses the confirmation prompt for each computer. The Restart parameter restarts the computers to make the change effective.
매개 변수
-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 (FQDN) of the remote
computers. To specify the local computer, type the computer name, a dot (.
), or localhost
.
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.
매개 변수 속성
형식: | String[] |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
Remote
Position: | Named |
필수: | False |
파이프라인의 값: | True |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
매개 변수 속성
형식: | SwitchParameter |
Default value: | False |
와일드카드 지원: | False |
DontShow: | False |
별칭: | cf |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Force
Suppresses the user prompt. By default, Remove-Computer
prompts you for confirmation before
removing each computer.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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, 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 PowerShell 3.0.
매개 변수 속성
형식: | PSCredential |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
Remote
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-PassThru
Returns the results of the command. Otherwise, this cmdlet does not generate any output.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Restart
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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
To specify a user account that has permission to connect to the remote computers, use the LocalCredential parameter.
This parameter was introduced in PowerShell 3.0.
매개 변수 속성
형식: | PSCredential |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | Credential |
매개 변수 집합
Local
Position: | 0 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
Remote
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
매개 변수 속성
형식: | SwitchParameter |
Default value: | False |
와일드카드 지원: | False |
DontShow: | False |
별칭: | wi |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | String |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
입력
String
You can pipe computer names to this cmdlet.
출력
ComputerChangeInfo
When you use the PassThru parameter, Remove-Computer
returns a ComputerChangeInfo object.
Otherwise, this cmdlet does not generate any output.
참고
This cmdlet does not remove computers from workgroups.