dlwyatt / PolicyFileEditor

PowerShell functions and DSC resource wrappers around the TJX.PolFileEditor.PolFile .NET class.
Apache License 2.0
189 stars 33 forks source link

Local Policy Editor Stops Working After Applying Configuration #9

Closed GamerLivingWill closed 6 years ago

GamerLivingWill commented 6 years ago

Hey there Dave,

I'm attempting to use this module for configuring local policies and running into the following issue after I apply a config. The error I have is as follows:

image

I'm assuming it's because I did something horrible. I'm just not quite sure syntactically what I did.


        cAdministrativeTemplateSetting NoWindowsHotKey
        {
            KeyValueName = '\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoWinKeys'
            PolicyType = 'User'
            Data = '1'
            Ensure = 'Present'
            Type = 'Dword'
        }

Pulling from the spreadsheet in another logged issue, here's the info that I was able to find on this specific policy.

1703 windowsexplorer.admx Turn off Windows Key hotkeys User Windows Components\File Explorer HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer!NoWinKeys At least Windows Server 2003 Turn off Windows Key hotkeys.  Keyboards with a Windows key provide users with shortcuts to common shell features. For example, pressing the keyboard sequence Windows+R opens the Run dialog box; pressing Windows+E starts File Explorer. By using this setting, you can disable these Windows Key hotkeys.  If you enable this setting, the Windows Key hotkeys are unavailable.  If you disable or do not configure this setting, the Windows Key hotkeys are available.

Halp! :P

dlwyatt commented 6 years ago

It's probably that leading backslash on your KeyValueName. Try setting Ensure to Absent and see if the problem goes away, then apply the configuration again without the slash.

If that works, I'll update the code to strip any leading slashes since they're not helpful anyway.

GamerLivingWill commented 6 years ago

I'll give it a shot and let you know the result. Thanks!

GamerLivingWill commented 6 years ago

It was definitely the leading backslash that did it. Working great now. Thanks man!

dlwyatt commented 6 years ago

Released 3.0.1 with the fix; new version is on PSGallery.