How to update #commented existing registry value

Welcome Forums General PowerShell Q&A How to update #commented existing registry value

Viewing 4 reply threads
  • Author
    Posts
    • #212709
      Participant
      Topics: 6
      Replies: 5
      Points: 82
      Rank: Member

      Hi,

      I have registry property Unicode without value for that property:

      Get-ItemProperty -Path “HKLM:\Software\PCTAIL”

      #Unicode

      If I set this registry value:

      Set-ItemProperty -Path “HKLM:\Software\PCTAIL\” -Name Unicode -Value 1

      And then again do get command:

      Get-ItemProperty -Path “HKLM:\Software\PCTAIL”

      Unfortunately I see two values!

      #Unicode 

      Unicode   1

      But actually I would need only second one.

      I think only the best approach is to UPDATE already existing row (without deletion) if this is possible somehow and not to create two duplicate rows…

      How this can be resolved succesfully? Why I am getting two duplicated rows?

      Thanks in advance

       

    • #212715
      Participant
      Topics: 4
      Replies: 2231
      Points: 5,414
      Helping Hand
      Rank: Community MVP

      This might help you to work with registry values:

      https://docs.microsoft.com/en-us/powershell/scripting/samples/working-with-registry-entries?view=powershell-7

      To read the value you have written you have specify what property you’d like to read

      (Get-ItemProperty -Path "HKLM:\Software\PCTAIL" -Name Unicode).Unicode
    • #212826
      Participant
      Topics: 6
      Replies: 5
      Points: 82
      Rank: Member

      Hi,

       

      thanks but unfortunately this does not resolve my issue. I already know how to create new value and how to read value. But I do not know how to just update existing #commented row.

      Does anyone may help with this one?

      Thanks in advance!!!

    • #212829
      Participant
      Topics: 4
      Replies: 2231
      Points: 5,414
      Helping Hand
      Rank: Community MVP

      But I do not know how to just update existing #commented row.

      Does anyone may help with this one?

      I have never heard of something like a #commented row in my last 20 years in the IT industry. Either you’re not using the right name or you discovered something completely new. 😉 To set an existing property value you use Set-ItemProperty.

    • #212913
      Participant
      Topics: 6
      Replies: 5
      Points: 82
      Rank: Member

      Thanks,

      it seems that solution for my problem was combination of

      Rename-Item

      and after it

      Set-Item.

      Thanks for assistance.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.