K3.6 - Post Install Task to Join Domain Loops
Having a strange issue with one of my Post install tasks, which joins the computer to the domain. We are using Powershell - and had it working fine on version 3.5.
My original problem in 3.6 was running via CMD - which I have changed to a Batch File. The command I am using to call the PS Script:
cmd.exe /c powershell -nologo -executionpolicy bypass -noprofile -file ".\domain.ps1"
It does call the script, and joins the computer to the domain - so that part works. However after reboot it tries to run this task again - and again - and again. The only way I can get it past this task is to be in front of the PC - and attempt to close it before it runs.
This is the only task that it happens to.
Below is the PS Script in case it is something inside it:
$username = “Account We Use”
$password = ConvertTo-SecureString “Password Used” -AsPlainText -Force
$myCred = New-Object System.Management.Automation.PSCredential $username, $password
Add-Computer -DomainName smdhu.net -Credential $mycred; restart-computer