Powershell registry error wrong key

Filip 831 Reputation points
2021-04-20T10:28:47.023+00:00

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
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,443 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 101.2K Reputation points MVP
    2021-04-20T11:08:01.213+00:00

    Hi @Filip ,

    why are you not using Get-ItemProperty ?
    https://learn.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

    0 comments No comments

0 additional answers

Sort by: Most helpful