Destroy then Redeploy with same AD machine name

Occasional Visitor



A bit of context...


We are deploying servers into AWS with terraform. We want to be able to quickly destroy and deploy machines with the same name. The primary reason is we want the machine to maintain any permissions, groups etc it's a member of. Particularly DNS.


To do this, we're trying to reset the computer object account so that the newly deployed machine can assume it. So far, I've tried the following:


Reset Account from ADUC GUI

Set-AdAccountPassword -identity $Computer -NewPassword (convertto-securestring "computername$" -asplaintext -force)

Checked for a method on the computer object, but none available.


Neither option works. I'm aware there's also the function reset-computermachinepassword, but that needs to be run from the computer itself and we're taking the assumption that won't be possible.


Have I missed anything, or is resetting the computer account not going to work in this case?





0 Replies