Registry using get-childitem

OK I have been using Get-childitem to travserse the registry

but have just noticed it is only loading the 1st 10 Childtems the last 4 are not being loaded why not

My command is as follows

$root = “Registry::HKLM\SOFTWARE\Microsoft\Folder XX”

$res = get-childitem -Path $Root

This works but will only load the first 10 Rows the rest are excluded

how do i get the additional items

Thanks

alnor,
Welcome to the forum. :wave:t4:

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.

Thanks in advance

How to format code in PowerShell.org <---- Click :point_up_2:t4: :wink:

Could it be because I am running this on a server ?

I doubt that.

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?

PshellHelp

I have added a screenshot of the folder as it appears in regedit

code to follow

# 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 just can repeat myself again … I cannot reproduce your issue. On a SCCM server I tried the following code:

$Path = 'REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server'
$Result = Get-ChildItem -Path $Path
$Result.Name
$Result.count

… and the output is this:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\110
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\120
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\130
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\140
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\ExceptionMessageBox
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSODBCSQL13
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSODBCSQL17
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13E.LOCALDB
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL14.SCCM
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\RefCount
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SCCM
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Services
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SharedManagementObjects
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SqlCmdLnUtils
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SQLNCLI11
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SqlWriter
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SSRS
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\TSqlLanguageService
21

EDIT:
I tried your code as well and the output was the same. :man_shrugging:t4:

Thanks for that OLAF

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)

That does not make any difference at all for me. It’s always the same result. But at least you have a direction where to search for the cause. :wink: