SCCM 2012 is a 32bit client, to run a PowerShell script on a 64bit machine in 64bit processing mode you have to call the powershell.exe with full path.
%winDir%\Sysnative\windowsPowershell\v1.0\Powershell.exe -ExecutionPolicy Bypass -File .\script.ps1
Do you want to prevent non-admins from joining computer to the domain? Be default Microsoft allows authenticated users to join 10 computer to the domain, here’s how to change that.
- Right click your domain name and select ‘Properties’
- find ms-DS-MachineAccountQuota an change to 0