Help with powershell filtering


I am in need of help with learning to filter.

I run the following:

get-item HKLM:\SYSTEM\CurrentControlSet\Services* | where-object {$ -eq ‘start’}


xinputhid ImagePath : \SystemRoot\System32\drivers\xinputhid.sys
Type : 1
Start : 3
ErrorControl : 1
Group : Base
Tag : 1
DisplayName : @xinputhid.inf,%xinputhid.SvcDesc%;XINPUT HID Filter Driver
Owners : {xinputhid.inf}
ConfigFlags : 1
DevicePropertyFlags : 14

How would it be possible to filter more to focus on “Start : 3” and also provide a count of the instances of “Start: 3” ?

I have tried various options, but no success.
Any asistance would be greatly appreciated.

Welcome to the forum. :wave:t4:

What do you actually want? Do you want to learn how to filter or do you search for services with a specific start type?

Running your code like you shared it it should actually return nothing at all. If you remove the pipe and run only the first part it should return the object representing the registry path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services. If you’re looking for the individual services you should run it like this:

Get-Item -Path HKLM:\SYSTEM\CurrentControlSet\Services\* | Where-Object {$ -eq 'start'}

!! notice the backslash right before the asterisk.

Since "Start : 3" is just the text representation PowerShell creates for you as ouput of the DWORD value of 3 of the setting "Start" you would need to read those values for each individual service and check if it’s 3.

An easier way to get those information would be to use

And 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 <---- Click :point_up_2:t4: :wink: