Changing reg key during SCCM TS- error 4634

ExhaustedTech 1 Reputation point

I have spent a significant amount of days trying to get this working and cannot. I am trying to change a few reg keys at the end of a TS. Obviously, after the OS is installed.
Reg import and reg add do not work because of Access Denied in regedit errors. I am able to run psexec to make the change but it will not run during the TS, only after I login.
I am not looking to make these permanent changes through GPO, only looking for answers as to why it doesn't work in the TS.

I have a step that copies the PSTools to c:\, earlier in the TS. When it gets to the step to run the changes, it errors out with 4634 (which I can't find anywhere online). What is happening?
This is a sample of one command being run and again, if I login when the TS is done, I can run this in CMD with no issues:
C:\PSTools\psexec64 -d -i -s /accepteula reg add "HKLM\System\ControlSet001\Control\Power\User\PowerSchemes\8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c\2a737441-1930-4402-8d77-b2bebba308a3\48e6b7a6-50f5-4782-a5d4-53bb8f07e226" /f /v DCSettingIndex /t REG_DWORD /d 0
but it will absolutely not go during TS.

Process completed with exit code 4436 TSManager
Showing task sequence error message after failure in task sequence step of type 'SMS_TaskSequence_RunCommandLineAction' TSManager
Execution::enExecutionFail != m_eExecutionResult, HRESULT=80004005 (X:\bt\1022896\repo\src\client\TaskSequence\TSManager\tsmanager.cpp,1293)
Task sequence execution failed with error code 80004005

Can anyone explain why this doesn't work or another solution to make a reg key addition/change that bypasses permissions?

And to clarify, I have also tried running it as local admin and as a SMSTSPostAction Variable.

Microsoft Configuration Manager Deployment
Microsoft Configuration Manager Deployment
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Deployment: The process of delivering, assembling, and maintaining a particular version of a software system at a site.
679 questions
Microsoft Configuration Manager
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Rahul Jindal [MVP] 7,431 Reputation points MVP

    Sorry, but why are you using psexec to import a registry at all? Just use reg import normally.

  2. ExhaustedTech 1 Reputation point

    I'm not trying to set high performance, that would be significantly easier.
    I'm aware that reg import works for most other keys/values but it does not work for this specific instance so I'm trying to figure out why.

    I've already tried as a package, script, batch, CMD, PS, inside and outside of SMSPostAction, with specifying a local admin and with it running as system.
    Either they run but don't apply or like I said above, it gives me this errors. I cannot find any information on those errors, that's what I'm trying to figure out

    0 comments No comments

  3. Jason Sandys 30,931 Reputation points Microsoft Employee

    Assuming you are trying to activate a specific power plan, have you tried using the Activate method of the Win32_PowerPlan WMI class? Reference:

    Alternatively, as @Rahul Jindal [MVP] called out, the /SETDCVALUEINDEX option for powercfg.exe will accomplish this also as powercfg is for much more than simply selecting a default/built-in power scheme.