Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Reporting on registry values

Reply
 
Old 05-23-2008   #1 (permalink)
Tim


 
 

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 SpecsSystem Spec
Old 05-23-2008   #2 (permalink)
Shay Levi


 
 

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 SpecsSystem Spec
Old 05-26-2008   #3 (permalink)
Tim


 
 

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46