change a registry value for a AppVPackage

Welcome Forums General PowerShell Q&A change a registry value for a AppVPackage

Viewing 5 reply threads
  • Author
    Posts
    • #201726
      Participant
      Topics: 3
      Replies: 3
      Points: 45
      Rank: Member

      Hello,

      I want to change a registry value for a AppVPackage by using below commands, but it’s not working. Any idea why?

      $AppVName = Get-AppvClientPackage -PackageId ef1af223-8cc4-4622-a8c2-cd5af4308d05
      $AppVName
      Start-AppvVirtualProcess -AppvClientObject $AppVName cmd.exe
      set-itemproperty HKCU:\Software\FRS\FiRE\Defaults JREPath C:\Program Files (x86)\Java\jre1.8.0_231
      • This topic was modified 4 months, 4 weeks ago by grokkit. Reason: please format your code as per the forum posting instructions
    • #201735
      js
      Participant
      Topics: 30
      Replies: 828
      Points: 2,553
      Helping Hand
      Rank: Community Hero

      I have no experience with this. I guess you have to run it under the cmd process. Or use reg.exe instead.

      Start-AppvVirtualProcess -AppvClientObject $AppVName cmd.exe '/c powershell set-itemproperty HKCU:\Software\FRS\FiRE\Defaults JREPath "C:\Program Files (x86)\Java\jre1.8.0_231"'
      

      Or this? I’m not sure if the argumentlist can be an array or a space seperated string, or maybe both work, if it’s like start-process:

      Start-AppvVirtualProcess -AppvClientObject $AppVName -filepath powershell -argumentlist set-itemproperty, HKCU:\Software\FRS\FiRE\Defaults, JREPath, "C:\Program Files (x86)\Java\jre1.8.0_231"
      
      • This reply was modified 5 months ago by js.
      • This reply was modified 5 months ago by js.
      • This reply was modified 5 months ago by js.
      • This reply was modified 5 months ago by js.
      • This reply was modified 5 months ago by js.
    • #202019
      Senior Moderator
      Topics: 3
      Replies: 123
      Points: 653
      Helping Hand
      Rank: Major Contributor
      set-itemproperty HKCU:\Software\FRS\FiRE\Defaults JREPath C:\Program Files (x86)\Java\jre1.8.0_231

      The immediate problem is that the spaces in C:\Program Files (x86)\Java\jre1.8.0_231 are causing PowerShell to be unable to interpret your input parameters. You should always wrap paths in quotes so that the shell doesn’t parse special characters and spaces:

      set-itemproperty 'HKCU:\Software\FRS\FiRE\Defaults' JREPath 'C:\Program Files (x86)\Java\jre1.8.0_231'

      Also, for the sake of safety when editing the registry, you should specify each parameter explicitly rather than using the shorthand method. Every tutorial about registry editing with PowerShell, and the documentation for Set-ItemProperty, shows the full parameter names being typed out.

      Set-ItemProperty -Path 'HKCU:\Software\FRS\FiRE\Defaults' -Name 'JREPath' -Value 'C:\Program Files (x86)\Java\jre1.8.0_231'

      It pays to be careful with the registry.

      • This reply was modified 4 months, 4 weeks ago by grokkit.
    • #202025
      js
      Participant
      Topics: 30
      Replies: 828
      Points: 2,553
      Helping Hand
      Rank: Community Hero

      Note that set-itemproperty has a -Type parameter with registry paths, but it’s not documented in an obvious place.

    • #202352
      Participant
      Topics: 3
      Replies: 3
      Points: 45
      Rank: Member
      <textarea class=”ace_text-input” style=”opacity: 0; height: 18px; width: 6.59781px; left: 44px; top: 0px;” spellcheck=”false” wrap=”off”></textarea>

      1
      set-itemproperty HKCU:\Software\FRS\FiRE\Defaults JREPath C:\Program Files (x86)\Java\jre1.8.0_231
      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

      The immediate problem is that the spaces in C:\Program Files (x86)\Java\jre1.8.0_231 are causing PowerShell to be unable to interpret your input parameters. You should always wrap paths in quotes so that the shell doesn’t parse special characters and spaces:

      <textarea class=”ace_text-input” style=”opacity: 0; height: 18px; width: 6.59781px; left: 426.673px; top: 0px;” spellcheck=”false” wrap=”off”></textarea>

      1
      set-itemproperty ‘HKCU:\Software\FRS\FiRE\Defaults’ JREPath ‘C:\Program Files (x86)\Java\jre1.8.0_231’
      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

      Also, for the sake of safety when editing the registry, you should specify each parameter explicitly rather than using the shorthand method. Every tutorial about registry editing with PowerShell, and the documentation for Set-ItemProperty, shows the full parameter names being typed out.

      <textarea class=”ace_text-input” style=”opacity: 0; height: 18px; width: 6.59781px; left: 44px; top: 0px;” spellcheck=”false” wrap=”off”></textarea>

      1
      Set-ItemProperty Path ‘HKCU:\Software\FRS\FiRE\Defaults’ Name ‘JREPath’ Value ‘C:\Program Files (x86)\Java\jre1.8.0_231’
      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

      It pays to be careful with the registry.

      Ok, the below ‘Set-ItemProperty’ command is working, but the registry change is not done in the registry for the AppVpackage rather in the normal window registry. How can I load the virtual registry appV package before the ‘Set-ItemProperty’ command?

       

    • #202445
      Senior Moderator
      Topics: 3
      Replies: 123
      Points: 653
      Helping Hand
      Rank: Major Contributor

      I think this is what you’re looking for: How to Configure the App-V Client Registry Settings by Using the Command Line, and specifically this part:

      Important On a 64-bit computer, the keys and values described in the following sections will be under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\SoftGrid\4.5\Client

      I think the registry subkeys for the AppV client will be listed under that path, but I don’t have an AppV environment to check it. You’ll have to look through your own registry to verify.

      • This reply was modified 4 months, 3 weeks ago by grokkit.
Viewing 5 reply threads
  • The topic ‘change a registry value for a AppVPackage’ is closed to new replies.