Changing value of a random registry entry

Welcome Forums General PowerShell Q&A Changing value of a random registry entry

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
7 months, 3 weeks ago.

  • Author
    Posts
  • #96947

    Participant
    Points: 0
    Rank: Member

    So I want to a copy the value of a registry entry to another one. Should be easy enough.

    $Value = Get-ItemPropertyValue HKLM\Software\PA\Globe\ -name IPaddress_333rrr
    This is the same on every computer so straight fwd.

    Set-ItemProperty HKLM\Software\PA\Globe\ -name -value $value

    Name of the entry is Ipaddress_ random characters and numbers. It's different on every machine. How can extract that so I put it -name switch? Under this key two entries says ipaddress with random characters one is the same on every computer. the other two say ipaddressV6 with random characters.

    The best I could come up with was get-item hklm\Software\PA\Globe\

    $property = Get-ItemProperty 'hklm\Software\PA\Globe\'
    $result = $property | Select-Object -Property ipaddress* -ExcludeProperty IpaddressIPv6*, IPAddress_fg5a2143b789235a4620e17bacdd2543

    Which gives me the results

    PS C:\windows\system32> $result

    IPaddress_29aff336a99e5a839ee77ac0d0a4170
    ——————————————-
    152.36.25.24

    How can I get that reg entry without the value?

  • #97002
    js

    Participant
    Points: 202
    Helping Hand
    Rank: Participant

    Using some super secret hidden properties:

    $name = $result.psobject.properties.name  
    
    • #97100

      Participant
      Points: 0
      Rank: Member

      Thank you so much, worked like charm. I have to do some research about that super secret line psojects and commands like it.

The topic ‘Changing value of a random registry entry’ is closed to new replies.