I cannot reproduce your issue. If there are more than 10 subkeys I get them listed.
BTW: When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
But I’m afraid it will be nearly impossible to help you without actually seeing your environment. Is the code you shared the complete code you’re using? Can you share the actual key you want to query? How many subkeys does this key actually have? Do you run this command from an elevated console? Do you get any errors?
# set the first path
$root = "Registry::HKLM\SOFTWARE\Microsoft\Microsoft SQL Server"
# Sub level depends on SQL version
$res = get-childitem -Path $root
ForEach ($strSubKey In $res)
{
$Name = $strSubKey.Name
write-host "Name $Name "
}
I have excluded everything else as it does not execute
I still got the same issue, so I tried testing on a few servers
The issue only occurs if I use Powershell ISE
but works fine if I use plain old powershell (I will have to bear that in Mind - dont understand why)