question

Filip-2434 avatar image
0 Votes"
Filip-2434 asked AndreasBaumgarten edited

Powershell registry error wrong key

Hello
I tried this command :

 (New-Object -ComObject WScript.Shell).RegRead("HKCU:\Control Panel\Colors\")

And it show me an error.
89516-a.png
What is wrong?

Thanks for help.


windows-server-powershell
a.png (26.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered AndreasBaumgarten edited

Hi @Filip-2434 ,

why are you not using Get-ItemProperty ?
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-itemproperty?view=powershell-7.1

 $b = "HKCU:\Control Panel\Colors\"
 Get-ItemProperty -Path $b


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.