Invoke-HKCURegistrySettingsForAllUsers Not Applying to All User Profiles

//Invoke-HKCURegistrySettingsForAllUsers Not Applying to All User Profiles
Invoke-HKCURegistrySettingsForAllUsers Not Applying to All User Profiles 2017-09-03T22:00:25+00:00

The Toolkit Forums General Invoke-HKCURegistrySettingsForAllUsers Not Applying to All User Profiles

  • Author
    Posts
  • Alan
    Participant
    Post count: 6
    #2259 |

    I am trying to use the Invoke-HKCURegistrySettingsForAllUsers when installing an Adobe Reader update on Windows 10 x64. It is applying the updated registry keys in the current HKCU profile that I run PSADT in. It is not applying them to either the existing or a new profiles on the machine. I am using PSADT 3.6.9. There are no errors reported in ISE

    [scriptblock]$HKCURegistrySettings = {
    Set-RegistryKey -Key ‘HKCU:SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723’ -Name ‘NoOpenWith’ -Value ” -Type String -SID $UserProfile.SID
    Set-RegistryKey -Key ‘HKCU:SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723’ -Name ‘NoStaticDefaultVerb’ -Value ” -Type String -SID $UserProfile.SID
    Set-RegistryKey -Key ‘HKCU:SOFTWARE\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9’ -Name ‘NoOpenWith’ -Value ” -Type String -SID $UserProfile.SID
    Set-RegistryKey -Key ‘HKCU:SOFTWARE\Classes\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9’ -Name ‘NoStaticDefaultVerb’ -Value ” -Type String -SID $UserProfile.SID
    }
    Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings`

    Any ideas?

    Thanks

  • Francois
    Participant
    Post count: 101

    Hi,

    Why not doing an active-setup?

  • Alan
    Participant
    Post count: 6

    I read lots of posts that claimed PSADT Invoke-HKCURegistrySettingsForAllUsers the best way to go. Easier… and it sounds like it would be if I could get it to work. Do you see anything wrong in my code?

    • Francois
      Participant
      Post count: 101

      Hi,

      PSADTK Active setup is using Invoke-HKCURegistrySettingsForAllUsers. So yes, you will have to set an active-setup.

      Active-setup is run before the load of the shell if it is a problem then you would need to set a run once and then building it with Invoke-HKCURegistrySettingsForAllUsers.

      Make it easy for you and use an active-setup.

  • Jim
    Participant
    Post count: 45

    You’re not setting any values? Are you trying to remove the existing values?

  • Alan
    Participant
    Post count: 6

    I am trying to create new 4 values (1607) as listed above to stop Edge from highjacking file associations (PDF and HTM). My hope was to drop these reg keys and then proceed with my Acrobat Reader update. I did try active-setup and it appears to work as advertised. Are you able to test on a Windows 10 x64 with PSADT 3.6.9 and see if nvoke-HKCURegistrySettingsForAllUsers works in all profiles (existing and new) on your machine?

    • Francois
      Participant
      Post count: 101

      There are no values.

  • Jim
    Participant
    Post count: 45

    Once I changed the value from the single double quote to ‘1607’ and removed the single quote at the end of the last line it worked fine. It set the values for all existing users including default user.

  • Alan
    Participant
    Post count: 6

    Jim

    That is great news. I am not sure I am following what you did to resolve the issue. Please give me an example of the changes you made with my code.

  • Jim
    Participant
    Post count: 45

    Your code:

    Set-RegistryKey -Key ‘HKCU:SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723’ -Name ‘NoOpenWith’ -Value -Type String -SID $UserProfile.SID

    Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings`

    My code:

    Set-RegistryKey -Key ‘HKCU:SOFTWARE\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723’ -Name ‘NoOpenWith’ -Value '1607' -Type String -SID $UserProfile.SID

    Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings

  • Alan
    Participant
    Post count: 6

    Ok.

    On the line with the ‘NoOpenWith’ -Value ‘1607’ -Type String -SID $UserProfile.SID where you added ‘1607’ maybe adding that value was the fix? Unfortunately the key needs to be null per many posts (see below) I think. Is using ” for a null value incorrect?

    How to Stop Edge From Hijacking Your PDF or HTML Associations

    The other weird character ` at the end of my code got added when I tried to use the code tags on this page. It was not in my actual code.

    • This reply was modified 2 months, 2 weeks ago by  Alan.
  • Jim
    Participant
    Post count: 45

    In a previous post I asked if you were trying to remove values and you said, “I am trying to create new 4 values (1607)”. That’s where I got the 1607 from…

    I think the problem is you have (one) double-quote for your value: -Value ”. What you should have is (2) single-quotes: -Value ”.

    Or maybe you had single quotes and the site changed them to double? If that’s the case, then I’m not sure what the issue is.

  • Alan
    Participant
    Post count: 6

    Sorry for the confusion. 1607 is the build of Windows 10 I am using. I am definitely trying to add keys. The key have no value.

    [HKEY_CURRENT_USER\Software\Classes\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723]
    “NoOpenWith”=””
    “NoStaticDefaultVerb”=””

    And you are correct I am using 2 single quotes but the site makes it look like 1 double.

You must be logged in to reply to this topic.