add runonce entry registry system/machine level note: ps policy? Set-Location -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce' Set-ItemProperty -Path . -Name joinDomain -Value "C:\scripts\joinDomain.ps1" Restart-Computer