Error retrieving registry value with Powershell

Question:

I’m attempting to read a value from a registry entry with Powershell. This is fairly simple, however, one particular registry key is giving me trouble.

If I run the following, I can’t get the value of the (default) of “$setting”.

Normally, I would do $setting.Attribute, or $setting.(default). However, that results in the following error:

How do I get the value of the “(default)” attribute?

Thanks in advance.

Answer:

EDIT Had to look through and old script to figure this out.

The trick is that you need to look inside the underlying PSObject to get the values. In particular look at the properties bag

You can also just use an indexer instead of doing the filter trick

Source:

Error retrieving registry value with Powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply