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\Registryif 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
$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.
Leave a Reply Cancel reply