Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get-WmiObject Win32_Product

1,332 views
Skip to first unread message

Keith Hill

unread,
Feb 24, 2007, 10:01:28 PM2/24/07
to
This query on Windows XP takes a long time and on Vista it fails in both
standard user and admin consoles:

1> Get-WmiObject Win32_Product


IdentifyingNumber : {8A7CAA24-7B23-410B-A7C3-F994B0944160}
Name : Microsoft Virtual PC 2007
Vendor : Microsoft Corporation
Version : 6.0.156.0
Caption : Microsoft Virtual PC 2007

Get-WmiObject : Generic failure
At line:1 char:14
+ Get-WmiObject <<<< Win32_Product

Any ideas what's going on here?

--
Keith

Keith Hill

unread,
Feb 24, 2007, 11:32:49 PM2/24/07
to
"Keith Hill" <r_keit...@mailhot.nospamIdotcom> wrote in message
news:256A3BA9-BD1A-4815...@microsoft.com...

> This query on Windows XP takes a long time

On my XP machine at work it took:

6> measure-command { gwmi win32_Product > InstalledProducts.txt }


Days : 0
Hours : 0
Minutes : 2
Seconds : 23
Milliseconds : 674
Ticks : 1436742418
TotalDays : 0.00166289631712963
TotalHours : 0.0399095116111111
TotalMinutes : 2.39457069666667
TotalSeconds : 143.6742418
TotalMilliseconds : 143674.2418

For about 141 installed products. If I use the registry it takes far less
time:

15> $selectExpr = @{Expression={(Get-ItemProperty $_.PSPath
DisplayName).DisplayName};Name='DisplayName'}
16> measure-command { dir
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | Select
PSChildName,$selectExpr }


Days : 0
Hours : 0
Minutes : 0
Seconds : 1
Milliseconds : 439
Ticks : 14394848
TotalDays : 1.66607037037037E-05
TotalHours : 0.000399856888888889
TotalMinutes : 0.0239914133333333
TotalSeconds : 1.4394848
TotalMilliseconds : 1439.4848

Of course, I get a bunch of duplicate entries...

--
Keith

Jeffrey Snover [MSFT]

unread,
Feb 25, 2007, 5:40:11 PM2/25/07
to
This is a known bug in Vista and is scheduled for a fix in SP1.

"Keith Hill" <r_keit...@mailhot.nospamIdotcom> wrote in message
news:256A3BA9-BD1A-4815...@microsoft.com...

--
Jeffrey Snover [MSFT]
Windows PowerShell Architect
Microsoft Corporation
This posting is provided "AS IS" with no warranties, no confers rights.
Visit the Windows PowerShell Team blog at:
http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:
http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

forestial

unread,
Feb 26, 2007, 9:54:05 AM2/26/07
to
For what it's worth: whatever is causing this to take a long time in XP, it
is not Powershell. I ran the equivalent WMI query using another tool and it
takes the same amount of time that way. While the query is running, the
process wmiprvse.exe is using all of one CPU on the machine.

The same seems to happen for several of the WMI classes related to this:
Win32_Product, Win32_ProductCheck, Win32_ProductResouce and
Win32_ProductSoftwareFeatures all take a surprisingly long time to complete.

Keith Hill

unread,
Feb 26, 2007, 10:06:44 AM2/26/07
to
"forestial" <fore...@discussions.microsoft.com> wrote in message
news:D7D87879-EF27-4E0E...@microsoft.com...

> For what it's worth: whatever is causing this to take a long time in XP,
> it
> is not Powershell. I ran the equivalent WMI query using another tool and
> it
> takes the same amount of time that way. While the query is running, the
> process wmiprvse.exe is using all of one CPU on the machine.
>
> The same seems to happen for several of the WMI classes related to this:
> Win32_Product, Win32_ProductCheck, Win32_ProductResouce and
> Win32_ProductSoftwareFeatures all take a surprisingly long time to
> complete.
>

Thanks. It's good to know that PowerShell isn't at fault with this issue.

--
Keith

forestial

unread,
Feb 26, 2007, 3:21:25 PM2/26/07
to
I tried it on a Vista x64 system, and it works as expected there. Still
takes a while, though - 32 seconds to list just 33 installed products, and
this is on a Core 2 Duo 2.8GHz machine with one of the cores going full bore
throughout the query.
0 new messages