Home All Groups Group Topic Archive Search About

Win32_Product query hangs when logged into Domain



Author
26 Nov 2007 10:38 AM
marcossoft
Hi all,

I'm trying to run the script below to get all installed software on my
Windows XP SP2 box. When I'm logged in locally (on the computer itself) it
works flawlessly but when I'm logged into my company's Domain Controller the
script hangs, the processor hits 100% of usage and nothing is returned :-(,
could someone provide me any clue ?.

PS.: The user logged into the domain is part of the machine's Administrators
group.

' The script (as it was copied from TechNet)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("c:\scripts\software.tsv", True)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
    ("Select * from Win32_Product")

objTextFile.WriteLine "Caption" & vbtab & _
    "Description" & vbtab & "Identifying Number" & vbtab & _
    "Install Date" & vbtab & "Install Location" & vbtab & _
    "Install State" & vbtab & "Name" & vbtab & _
    "Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
        & "Version"

For Each objSoftware in colSoftware
    objTextFile.WriteLine objSoftware.Caption & vbtab & _
    objSoftware.Description & vbtab & _
    objSoftware.IdentifyingNumber & vbtab & _
    objSoftware.InstallDate2 & vbtab & _
    objSoftware.InstallLocation & vbtab & _
    objSoftware.InstallState & vbtab & _
    objSoftware.Name & vbtab & _
    objSoftware.PackageCache & vbtab & _
    objSoftware.SKUNumber & vbtab & _
    objSoftware.Vendor & vbtab & _
    objSoftware.Version
Next
objTextFile.Close

Thank you very much !!
Marcos

Author
26 Nov 2007 12:37 PM
Jeffery Hicks [MVP]
WMI queries for this class are notoriously slow and resource intensive.  Are
your running this script locally on the DC or accessing it remotely?  How is
resource utilization on the DC?  Is it doing other things in addition to
being a domain controller?

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.
Show quote
"marcossoft" <marcoss***@discussions.microsoft.com> wrote in message
news:0CDC4DAC-8882-4EE8-B350-D0FBB865DA47@microsoft.com...
> Hi all,
>
> I'm trying to run the script below to get all installed software on my
> Windows XP SP2 box. When I'm logged in locally (on the computer itself) it
> works flawlessly but when I'm logged into my company's Domain Controller
> the
> script hangs, the processor hits 100% of usage and nothing is returned
> :-(,
> could someone provide me any clue ?.
>
> PS.: The user logged into the domain is part of the machine's
> Administrators
> group.
>
> ' The script (as it was copied from TechNet)
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objTextFile = objFSO.CreateTextFile("c:\scripts\software.tsv", True)
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
>    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
> Set colSoftware = objWMIService.ExecQuery _
>    ("Select * from Win32_Product")
>
> objTextFile.WriteLine "Caption" & vbtab & _
>    "Description" & vbtab & "Identifying Number" & vbtab & _
>    "Install Date" & vbtab & "Install Location" & vbtab & _
>    "Install State" & vbtab & "Name" & vbtab & _
>    "Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
>        & "Version"
>
> For Each objSoftware in colSoftware
>    objTextFile.WriteLine objSoftware.Caption & vbtab & _
>    objSoftware.Description & vbtab & _
>    objSoftware.IdentifyingNumber & vbtab & _
>    objSoftware.InstallDate2 & vbtab & _
>    objSoftware.InstallLocation & vbtab & _
>    objSoftware.InstallState & vbtab & _
>    objSoftware.Name & vbtab & _
>    objSoftware.PackageCache & vbtab & _
>    objSoftware.SKUNumber & vbtab & _
>    objSoftware.Vendor & vbtab & _
>    objSoftware.Version
> Next
> objTextFile.Close
>
> Thank you very much !!
> Marcos
Author
26 Nov 2007 5:33 PM
marcossoft
"Jeffery Hicks [MVP]" wrote:

> WMI queries for this class are notoriously slow and resource intensive.
Thanks you are right ! I've wait a couple of minutes and the list was
displayed :-)
Author
26 Nov 2007 1:16 PM
Jeffery Hicks [MVP]
Your code works fine when executed locally on my 2003 SP2 test domain
controller.  Although there was only 1 app installed so it didn't take long.
If your DC has a lot of apps, this will certainly take time to process.

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.
Show quote
"marcossoft" <marcoss***@discussions.microsoft.com> wrote in message
news:0CDC4DAC-8882-4EE8-B350-D0FBB865DA47@microsoft.com...
> Hi all,
>
> I'm trying to run the script below to get all installed software on my
> Windows XP SP2 box. When I'm logged in locally (on the computer itself) it
> works flawlessly but when I'm logged into my company's Domain Controller
> the
> script hangs, the processor hits 100% of usage and nothing is returned
> :-(,
> could someone provide me any clue ?.
>
> PS.: The user logged into the domain is part of the machine's
> Administrators
> group.
>
> ' The script (as it was copied from TechNet)
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objTextFile = objFSO.CreateTextFile("c:\scripts\software.tsv", True)
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
>    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
> Set colSoftware = objWMIService.ExecQuery _
>    ("Select * from Win32_Product")
>
> objTextFile.WriteLine "Caption" & vbtab & _
>    "Description" & vbtab & "Identifying Number" & vbtab & _
>    "Install Date" & vbtab & "Install Location" & vbtab & _
>    "Install State" & vbtab & "Name" & vbtab & _
>    "Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
>        & "Version"
>
> For Each objSoftware in colSoftware
>    objTextFile.WriteLine objSoftware.Caption & vbtab & _
>    objSoftware.Description & vbtab & _
>    objSoftware.IdentifyingNumber & vbtab & _
>    objSoftware.InstallDate2 & vbtab & _
>    objSoftware.InstallLocation & vbtab & _
>    objSoftware.InstallState & vbtab & _
>    objSoftware.Name & vbtab & _
>    objSoftware.PackageCache & vbtab & _
>    objSoftware.SKUNumber & vbtab & _
>    objSoftware.Vendor & vbtab & _
>    objSoftware.Version
> Next
> objTextFile.Close
>
> Thank you very much !!
> Marcos

AddThis Social Bookmark Button