powershell - Trying to return all subkeys with a name falling between 0 and 1000 -
i'm working citrix registry keys in powershell. under "hklm:\software\wow6432node\policies\citrix" there numerous keys number followed handful of keys made of letters, "events, evidence, , ima."
i'm trying fill array subkeys of "hklm:\software\wow6432node\policies\citrix" numbers, can check values in each of them against golden image somewhere.
i'm assuming there fewer 1,000 such keys. far, i've tried:
$usersubkeys = get-childitem "hklm:\software\wow6432node\policies\citrix" -include [0..999] but returns nothing.
i can
$usersubkeys = get-childitem | where-object {$_.name -match "0" -or $_.name -match "1"} and separate -or each of "0" through "999" seems painful , ridiculous.
any suggestions?
you use either of below:
# returns keys name consists of characters 0-9 get-childitem "hklm:\software\wow6432node\policies\citrix" |?{ $_.name -match '^[0-9]+$' } # returns keys whos name can parsed integer get-childitem "hklm:\software\wow6432node\policies\citrix" |?{ [int]::tryparse($_.name, [ref] $null) }
Comments
Post a Comment