Reset-ComputerMachinePassword
Resets the machine account password for the computer.
语法
Default (默认值)
Reset-ComputerMachinePassword
[-Server <String>]
[-Credential <PSCredential>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
The Reset-ComputerMachinePassword cmdlet changes the computer account password that the computers use to authenticate to the domain controllers in the domain. You can use it to reset the password of the local computer.
示例
Example 1: Reset the password for the local computer
PS C:\> Reset-ComputerMachinePassword
This command resets the computer password for the local computer. The command runs with the credentials of the current user.
Example 2: Reset the password for the local computer by using a specified domain controller
PS C:\> Reset-ComputerMachinePassword -Server "DC01" -Credential Domain01\Admin01
This command resets the computer password of the local computer by using the DC01 domain controller. It uses the Credential parameter to specify a user account that has permission to reset a computer password in the domain.
Example 3: Reset the password on a remote computer
PS C:\> Invoke-Command -ComputerName "Server01" -ScriptBlock {Reset-ComputerMachinePassword}
This command uses the Invoke-Command cmdlet to run a Reset-ComputerMachinePassword command on the Server01 remote computer.
For more information about remote commands in Windows PowerShell, see about_Remote and Invoke-Command.
参数
-Confirm
Prompts you for confirmation before running the cmdlet.
参数属性
类型: | SwitchParameter |
默认值: | False |
支持通配符: | False |
不显示: | False |
别名: | cf |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Credential
Specifies a user account that has permission to perform this action. 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.
This parameter was introduced in Windows PowerShell 3.0.
参数属性
类型: | PSCredential |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Server
Specifies the name of a domain controller to use when this cmdlet sets the computer account password.
This parameter is optional. If you omit this parameter, a domain controller is chosen to service the command.
参数属性
类型: | String |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
参数属性
类型: | SwitchParameter |
默认值: | False |
支持通配符: | False |
不显示: | False |
别名: | wi |
参数集
(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.
输入
None
You cannot pipe input to this cmdlet.
输出
None
This cmdlet does not generate any output.