![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Reporting on registry values I am working on a project where I have to grab registry settings from a bunch of clients and run a report based on those settings. So far, I've gotten PowerShell to dump the settings from all of my clients to a text file (one for each client). The files are formatted as: Key name Key Value Key name Key Value ..... What I want to do is look through all the files for a key name of ProductVersion, for example, and tell me the total number of files that contain that value. And then tell me of that total, what number have version 8.0, what number have 8.1, etc. And I don't want to have to tell the script what values to look for. In other words, I don't know all of the different versions that may exist out there, I'd like the script to tell me that. Is there an easy way to do this? Thanks, Tim |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Reporting on registry values Try this: dir *.txt | foreach { switch -regex -file $_ {'ProductVersion\s+(\d+\.\d+)' {$matches[1]; $total+=1}} } | group -noElement "`nTotal found: $total" Here a sample output. The Name column is the key (ProductVersion) value: Count Name ----- ---- 1 2.0 3 8.0 3 8.1 1 3.1 3 7.6 1 8.6 Total found: 12 --- Shay Levi $cript Fanatic http://scriptolog.blogspot.com Quote: > I am working on a project where I have to grab registry settings from > a bunch of clients and run a report based on those settings. So far, > I've gotten PowerShell to dump the settings from all of my clients to > a text file (one for each client). The files are formatted as: > > Key name Key Value > Key name Key Value > .... > What I want to do is look through all the files for a key name of > ProductVersion, for example, and tell me the total number of files > that contain that value. And then tell me of that total, what number > have version 8.0, what number have 8.1, etc. And I don't want to have > to tell the script what values to look for. In other words, I don't > know all of the different versions that may exist out there, I'd like > the script to tell me that. > > Is there an easy way to do this? > > Thanks, > > Tim > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Reporting on registry values Wow! That's fantastic. Thanks Shay. On May 23, 8:38*pm, Shay Levi <n...@xxxxxx> wrote: Quote: > Try this: > > dir *.txt | foreach { switch -regex -file $_ {'ProductVersion\s+(\d+\.\d+)' > {$matches[1]; $total+=1}} } | group -noElement > > "`nTotal found: $total" > > Here a sample output. The Name column is the key (ProductVersion) value: > > Count Name * * * * * * * * * * > ----- ---- * * * * * * * * * * > * * 1 2.0 * * * * * * * * * * * > * * 3 8.0 * * * * * * * * * * * > * * 3 8.1 * * * * * * * * * * * > * * 1 3.1 * * * * * * * * * * * > * * 3 7.6 * * * * * * * * * * * > * * 1 8.6 * * * * * * * * * * * > > Total found: 12 > > --- > Shay Levi > $cript Fanatichttp://scriptolog.blogspot.com > > > Quote: > > I am working on a project where I have to grab registry settings from > > a bunch of clients and run a report based on those settings. *So far, > > I've gotten PowerShell to dump the settings from all of my clients to > > a text file (one for each client). The files are formatted as: Quote: > > Key name * * Key Value > > Key name * * Key Value > > .... > > What I want to do is look through all the files for a key name of > > ProductVersion, for example, and tell me the total number of files > > that contain that value. And then tell me of that total, what number > > have version 8.0, what number have 8.1, etc. *And I don't want to have > > to tell the script what values to look for. *In other words, I don't > > know all of the different versions that may exist out there, I'd like > > the script to tell me that. Quote: > > Is there an easy way to do this? Quote: > > Thanks, Quote: > > Tim- Hide quoted text - > - Show quoted text - |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Set/Create Registry Values | PowerShell | |||
| Legacy values removal in registry | Vista performance & maintenance | |||
| Writing values to Registry | General Discussion | |||
| Remote HKU registry values | PowerShell | |||
| need some registry values | Vista General | |||