Psexec AcceptEula via Sysprep

The latest versions of the PsTools suite require you to accept their EULA the first time they are run. This is on a per-user basis, so if you try and run something in the system context and forget to use the /accepteula or -accepteula flags it’ll fail. This is quite tedious.

Simply way to get around this is to set the registry key it uses to check if the EULA has been accepted manually. This is under:

"HKCU\Software\Sysinternals\"

With one key per product, e.g. for psexec:

"HKCU\Software\Sysinternals\PsExec"

The value pair to set under this is “EulaAccepted”, REG_DWORD, 0x00000001

Quick batch script which does this for all the pstools tools:

REG ADD "HKCU\Software\Sysinternals\PsExec" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\psfile" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsGetSid" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsInfo" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsKill" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsList" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsLoggedon" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsLoglist" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsPasswd" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsService" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsShutdown" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKCU\Software\Sysinternals\PsSuspend" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f

Of course, this only works for the user you are currently logged in with. However if you’re preparing OS images which will be prepared with Sysprep you can run this as the user you are intending to run sysprep with and the sysprep process will then roll these keys (along with other modifications to HKCU) into the registry profile used for all users when the machine comes out of sysprep. All subsequent users created on that machine should thus have the EULA pre-accepted, neatly bypassing the possibility of it going wrong when running commands.

For the “well-known” SIDs (e.g. S-1-5-18/Local System, S-1-5-19/Local Service and S-1-5-20/Network Service) you can set these directly via HKEY_USERS:

REG ADD "HKU\S-1-5-18\Software\Sysinternals\PsExec" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKU\S-1-5-19\Software\Sysinternals\PsExec" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f
REG ADD "HKU\S-1-5-20\Software\Sysinternals\PsExec" /v "EulaAccepted" /t REG_DWORD /d 00000001 /f