---
title: "PowerShell to Get a Registry Value: A Tutorial Walkthrough"
description: "Master using PowerShell to get registry values, key information, and more with this comprehensive tutorial."
canonical: "https://adamtheautomator.com/powershell-to-get-a-registry-value/"
---

# PowerShell to Get a Registry Value: A Tutorial Walkthrough

> Master using PowerShell to get registry values, key information, and more with this comprehensive tutorial.

Source: https://adamtheautomator.com/powershell-to-get-a-registry-value/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![PowerShell to Get a Registry Value: A Tutorial Walkthrough](https://adamtheautomator.com/wp-content/uploads/2020/12/How-to-use-PowerShell-to-Get-a-Registry-Value.jpg)

# PowerShell to Get a Registry Value: A Tutorial Walkthrough

[![](https://secure.gravatar.com/avatar/4147968aa2332aa682bcebf295e4e9d0eb2672dee3d9ae0523a00ac51e7d6017?s=192&d=mm&r=g)Bill Kindle](https://adamtheautomator.com/author/bill/)30 December 20203 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[PowerShell](/tag/powershell/)

Table of Contents

*   [Prerequisites](#h-prerequisites)
*   [Getting Registry Keys and Values with Get-ChildItem](#h-getting-registry-keys-and-values-with-get-childitem)
*   [Getting Registry Values with Get-ItemProperty](#h-getting-registry-values-with-get-itemproperty)
*   [Getting Registry Values with Get-ItemPropertyValue](#h-getting-registry-values-with-get-itempropertyvalue)
*   [Querying the Registry without PS Drives](#h-querying-the-registry-without-ps-drives)
*   [Testing Registry Values with Test-Path](#h-testing-registry-values-with-test-path)
*   [Next Steps](#h-next-steps)

In this article, learn how to use PowerShell to get a registry value and query entries in a registry using a variety of methods.

Let’s get going!

Not a reader? Watch this related video tutorial!

**_Not seeing the video? Make sure your ad blocker is disabled._**

## Prerequisites

All examples in this article will be demonstrated using PowerShell 7.1, which at the time this article was published, is the latest version. You can also use Windows PowerShell 5.1 if you choose. You should also have some basic understanding of _[PowerShell Drives](https://docs.microsoft.com/en-us/powershell/scripting/samples/managing-windows-powershell-drives?view=powershell-7.1)._

Some examples may not work without Administrator privileges.

## Getting Registry Keys and Values with `Get-ChildItem`

One of the easiest ways to find registry keys and values is using the `_Get-ChildItem_` cmdlet. This uses PowerShell to get a registry value and more by enumerating items in PowerShell drives. In this case, that PowerShell drive is the HKLM drive found by running `_Get-PSDrive_`.

Run the following command in a PowerShell console.

```powershell
Get-ChildItem -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\'
```

In the screenshot below, you can see:

1.  The full key path for the WindowsUpdate registry key
2.  The key AU
3.  The list of registry entries in the AU key with corresponding values

![Getting registry values for Windows Update](https://adamtheautomator.com/wp-content/uploads/2020/12/Untitled-2020-12-23T163040.095.png)

Getting registry values for Windows Update

One quick point regarding the above screenshot. You may notice that the output is a little misleading. Normally, PowerShell console output represents properties of an object. `Get-ChildItem` behaves differently in this case because this object technically has no properties. Extra commands are run in the background to produce display formatting that you see.

**_Related: [How to Check for a Pending Reboot in the Windows Registry](https://adamtheautomator.com/pending-reboot-registry/)_**

## Getting Registry Values with `Get-ItemProperty`

Continuing with the same registry key as before, let’s use the `Get-ItemProperty` cmdlet this time and make the output more readable.

Using `_Get-ItemProperty_` is best for getting an item property obtaining keys and their values within the registry. Run the command below:

```powershell
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
```

In the screenshot below, you see a list of the keys and values:

1.  For the registry container AU
2.  PowerShell related properties which all begin with **PS**

![Using Get-ItemProperty in PowerShell to get registry values](https://adamtheautomator.com/wp-content/uploads/2020/12/Untitled-2020-12-23T163128.450.png)

Using Get-ItemProperty in PowerShell to get registry values

As an alternative, you can also specify the registry item path to get the same output only slightly faster by using .NET. The below command is using the [.NET _Registry Class_](https://docs.microsoft.com/en-us/dotnet/api/microsoft.win32.registry?view=net-6.0&viewFallbackFrom=net-5.0) in PowerShell to get a registry value:

```powershell
Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
```

## Getting Registry Values with `Get-ItemPropertyValue`

Now It’s time to look at key values. Using the `_Get-ItemPropertyValue_` cmdlet with the same registry container as before, lets look at the value for the key `_NoAutoUpdate_`. Run the following PowerShell command:

```powershell
Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\' -Name NoAutoUpdate
```

Using `_Get-ItemPropertyValue_`, you will get a more succinct output only showing the value and not any of the other information you saw previously.

![NoAutoUpdate key and the corresponding value](https://adamtheautomator.com/wp-content/uploads/2020/12/Untitled-2020-12-23T163308.666.png)

NoAutoUpdate key and the corresponding value

## Querying the Registry without PS Drives

Throughout this tutorial, you’ve been using PowerShell drives to work with the registry. Doing it this way isn’t the only way; you can also leverage .NET and get registry information via .NET classes too!

For example, perhaps you need to use PowerShell to get a registry value of HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU\\ : AutoUpate on a remote computer.

You can do so with .NET by:

1.  Opening the registry connection on the remote computer.

```powershell
$Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $Computername)
```

2\. Opening the specific registry key you’re looking for.

```powershell
$RegistryKey = $Registry.OpenSubKey("SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", $true)
```

3\. Using the `GetValue()` method to query the value of the registry value inside of the registry key.

```powershell
$RegistryKey.GetValue('AU')
```

Using .NET rather than PowerShell drives is a bit faster and is an easy way to connect to and use PowerShell to query registry keys and values on remote computers.

## Testing Registry Values with `Test-Path`

Sometimes you just need to validate if a registry value is present. The way you do that is with the `_[Test-Path](https://adamtheautomator.com/powershell-test-path/)_` cmdlet.

Continuing with the WindowsUpdate container, test to see if the AU container is present by running the following PowerShell command:

```powershell
Test-Path -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
```

If the result is **True**, the key or container exists. But what if you need to test a value or entry exists? Let’s build a custom function for this test:

```powershell
Function Test-RegistryValue ($regkey, $name) {
     if (Get-ItemProperty -Path $regkey -Name $name -ErrorAction Ignore) {
         $true
     } else {
         $false
     }
 }
```

Using the custom function, you enter a path and name of the key or container, and the value you are looking for, and the custom function will return **True** or **False** (3) as shown in the screenshot below:

![Enter a Path Name to Return True or False](https://adamtheautomator.com/wp-content/uploads/2020/12/Untitled-2020-12-23T163406.825.png)

Enter a key and value to test and return True or False

## Next Steps

Know that you can use the `_Get-ChildItem_`, `_Get-ItemProperty_`, and `_Get-ItemPropertyValue_` in PowerShell to get a registry value and keys, what else can you do?

If you’d like to learn more about working with the registry with PowerShell, [_check out the article from Microsoft Docs titled, ‘Working with Registry Keys’_.](https://docs.microsoft.com/en-us/powershell/scripting/samples/working-with-registry-keys?view=powershell-7.1) You can also find a great demonstration of setting registry values in the ATA blog post _[Using Active Setup: How to Set a Registry Value in All Users Hives](https://adamtheautomator.com/active-setup-registry/)._

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-to-get-a-registry-value%2F&text=PowerShell%20to%20Get%20a%20Registry%20Value%3A%20A%20Tutorial%20Walkthrough)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-to-get-a-registry-value%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-to-get-a-registry-value%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

![](https://adamtheautomator.com/wp-content/uploads/2025/10/image_2025-10-24_095322075.png)

### [Migrating from PowerShell 6 to 7.5: Breaking Changes/New Features](/migrating-powershell-6-to-7-5/)

Migrate from PowerShell Core 6 to 7.5: breaking changes, features, and testing tips.

![](https://adamtheautomator.com/wp-content/uploads/2025/06/featured-image-6.png)

### [How to Add Timeouts to Pester Tests with PowerShell Runspaces](/pester-test-timeout-runspaces/)

Prevent Pester tests from hanging indefinitely using PowerShell runspaces. Learn to handle variable scoping, module loading, TestDrive access, and stream capture challenges with timeout protection.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
