This script will help you to capture registry values for multiple systems. 

Example: You have recently made some changes in the registry settings to a large number of systems. Now, you would like to know what are the registry value present under: "hklm:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", and capture the report for multiple systems. In this case, you need to do two things:

 

1) Prepare an input file with the list of systems. This will be a text file.

2) Within the script, enter the registry key / subkey path.

Ex: "hklm:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management".

Please note: You have to maintain the exact format of the key path as mentioned here. Do not write Hkey_Local_Machine, instead write in this format: "hklm:\"

 

Please note: 

 

PowerShell
Edit|Remove
Write-Host "  " 
 
$inputpathRead-Host "Please enter the location of the input file. This should be a TXT file containing list of systems." 
 
Write-Host "  " 
 
$outputpathRead-Host "Please enter the location of the output file. This should be a TXT file where all details would be extracted." 
 
Write-Host "  " 
 
$Serverlist = get-content -Path $inputpath 
 
$outputforeach ($Server in $ServerList) 
 
{ 
 
Write-Host "  " 
 
Write-Output "------------------------------------------------------" 
 
Write-Output "Server Name : $Server" 
 
Write-Output "------------------------------------------------------" 
 
Invoke-Command -ComputerName $Server -ScriptBlock { Get-ItemProperty -Path "hklm:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"} 
 
} 
 
$output | out-file -FilePath $outputpath -Append