PowerShell 2.0: One Cmdlet at a Time 7 Reset-ComputerMachinePassword

Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Reset-ComputerMachinePassword cmdlet.

What can I do with it?

Reset the computer account password for a machine.

Examples:

Reset the computer account password for the current local machine. It’s as simple as that!

Reset-ComputerMachinePassword

To do the same for a remote machine you will need to use Invoke-Command to run the command on the remote machine.

Invoke-Command -computername Server01 -scriptblock {Reset-ComputerMachinePassword}

How could I have done this in PowerShell 1.0?

You could have done the following.

[ADSI]$computer = “WinNT://WINDOWS2000/computername$” $computer.SetPassword(“computername$”)

More commonly you might have used the netdom command line tool to do this.

netdom reset ‘machinename’ /domain:‘domainname

Or you might have used Active Directory Users and Computers GUI tool, right-clicked the computer account in question and chosen Reset Account.

1000 things 1% better!