Edit Hkey_Current_User keys

Create te following steps for editing the Hkey_current_user. For example, this could be used in a Task Sequence in Config Manager.

User is not logged on to the client:

Load Hive
reg.exe load HKU\temphive c:\users\\ntuser.dat
Edit Registry
reg.exe add “HKU\temphive\Control Panel\Desktop” /v ScreenSaveActive /t REG_SZ /d 0 /f
Unload Hive
reg.exe unload HKU\temphive

User is logged on to the client

Use PSGETSID.EXE from sysinternals suite.

Script:

echo off

:: ——–
:: Turn off Echo

:: Variabable “uSID” to store UserSID
set uSID=

::Get SID and store in uSID
for /F “usebackq delims== skip=1” %%i in (`psgetsid.exe -accepteula User`) do set uSID=%%i

:: SID to screen
echo uSID=%uSID%

:: Set registry path to _key
set _KEY= HKU\%uSID%\AppEvents\Schemes\Apps\.Default\SystemAsterisk\.Current
echo _KEY=%_KEY%

:: Delete default value
Reg delete “%_KEY%” /ve /f

 

:: ———

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s