Skip navigation
skeleton keys laid out on white background

Q. How can I check to see if a registry key exists in PowerShell?

Q. How can I check to see if a registry key exists in PowerShell?

A. Keep in mind that the shell maps two drives—HKLM: and HKCU:—to the registry. Using those, you can use the Test-Path cmdlet to see if a key, which will behave more or less like a file system folder, exists.

Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish