DSC update registry in HKEY_CURRENT_USER to enable lock screen saver

747 views Asked by At

I have a DSC pull server that work great but lately I expirance issues to update registey value on HKEY_CURRENT_USER in order to enable screen saver.

DCS Resource:

Registry ScreenSaveActive
      {
            Ensure = "Present"  
            Key = "HKEY_CURRENT_USER\Control Panel\Desktop"
            ValueName = "ScreenSaveActive"
            ValueData = "1"
            Force = $True
        }

When I am trying to any value in "HKEY_LOCAL_MACHINE" it worked.

any Idea how to resolved it or alternative way.

Thanks, Cfir.

1

There are 1 answers

0
Nana Lakshmanan On

DSC runs in the context of local system. You will have to use RunAs with the desired user in order to access HKCU. This blog explains the feature in detail http://nanalakshmanan.com/blog/Understanding-RunAs/