List all registry values ​​through powershell

I am writing a powershell script and have encountered a problem. I have a registry key that contains a single value. I need to extract the name of the value, not its value. To be more clear, consider a key containing a DWORD value [@ 10.105.1.1 = 64]. I want to be able to extract the name of the value, in this case 10.105.1.1. I do not use the value that is set to 64. Also note that I do not create a registry key and the name of the value will differ from computer to computer, since it is more related to the settings used by another system, and I'm only trying to access the settings data .

0
source share
1 answer

You can get all the values ​​under a specific registry key, filter the data from the values ​​and then get the name of the value. In the following example, I list the values ​​under the CurrentVersion key, filter the values ​​based on data (games) and get the value name (SM_GamesName). For this example, the PSRemoteRegistry module is required :

Import-Module PSRemoteRegistry $key = 'SOFTWARE\Microsoft\Windows\CurrentVersion' Get-RegValue -Hive LocalMachine -Key $key | Where-Object {$_.Data -eq 'games'} | Foreach-Object { $_.Value } SM_GamesName 
+1
source

Source: https://habr.com/ru/post/1445607/


All Articles