How to iterate through remote registry keys using powershell?
问题 I have a powershell script that goes through a list of name value pairs in a registry key and do some maniuplations. All of this happens inside the below foreach-object loop Get-ChildItem "HKLM:\SOFTWARE\PathA\pathB" -Recurse | ForEach-Object { $regkey = (Get-ItemProperty $_.PSPath) | Where-Object { $_.PSPath -match 'debug' } if ($masterList.Contains($_.Name)) #Check if the reg key is in master list { Set-ItemProperty -Path $regkey.PSPath -Name $_.Name -Value 1 } } This works perfectly fine