I am using Powershell Script to join our Domain. It works fine except when the computer account already exists. I want to be able to join the domain with the account already existing. We use to do this with .vbs script but I can not find a way to do this with powershell. I work at a college and we re-image our PC's every semester or 2. We never delete the accounts when using .vbs script. We just join the domain on top the existing account.
Here is my Join Domain script. I am using it with an answer file.
$credential = New-Object System.Management.Automation.PsCredential("adminusername", (ConvertTo-SecureString "password" -AsPlainText -Force))
Add-Computer -domainname "ad.hccs.edu" -credential $credential -OUPath "OU=TestJoinDomain,OU=CE-Instructional-Computers,OU=CE-Computers,OU=CE,OU=Colleges,DC=ad,DC=hccs,DC=edu" -passthru;restart-computer;Remove-Item c:\joindomain.ps1
I only want powershell solutions. I know how to do this with .vbs script but I am trying to get away from .vbs script and use only powershell.
Does anyone have a good solution for this?