• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

TECHDIIP

  • Tech
  • Windows
  • Powershell
  • Scripts
  • News
  • Games

Powershell get registry key value | Multiple Remote Computers

How to check registry key value on any windows workstation or a server operating system, using a Powershell script this article explains how we can get a registry value, here are simple steps. When there is a need to check the registry value or property of a registry key then it’s easy through Powershell,  there is a command Get-ItemProperty retrieves the value. This article explains how to pull the registry value on remote computers as well. Syntax Get-ItemProperty example 1
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name "SM_GamesName"
Output
SM_GamesName : Games
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
PSChildName  : CurrentVersion
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry
if you want to get only the value then we have to store the output in a variable, see how it looks.

$value=Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name “SM_GamesName”

To retrieve the key value we need to use a variable.

$value.SM_GamesName #output registry key value as below. Games

How to get a registry value on remote computers Let’s see how to remove a local account on multiple remote computers. We need to create a file for storing all the servers or multiple machines list, I named it as Allservers.txt for and saved it in my local machine c:\temp\Allservers.txt
$Allserers = get-content -path "C:\temp\Allservers.txt"
foreach ($oneserver in $allservers)
{
write-host "Currently The Script is Running on"$oneserver
$value =Invoke-Command -ComputerName $onecomputer -ScriptBlock {Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name "SM_GamesName}
$value.SM_GamesName 
}
Thank you for reading this article, if you have any questions please let us know. Thank you for visiting my site, for any scripts in these articles you are testing please make sure you have tested this script in our lower environment before you run in production.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • Fixed : Page fault in nonpaged area 2022
  • Solved: Ethernet doesn’t have a valid IP configuration 2022
  • 5 Best Free Youtube Video to MP3 Converters in 2022
  • Fixed : Audio renderer error 2022
  • Fixed: Discord search not working 2022
  • About Us
  • CONTACT US
  • Disclaimer
  • Privacy Policy

Copyright © 2022 techdiip.com