iamtheky

Installed Software list - Ps + WMI + SCCM

11 posts in this topic

#1 ·  Posted (edited)

*Requires that you are a client of SCCM in order for SMS_ to exist/populate

This is an exercise in formatting data returned from CIM via powershell via Autoit.  Should get you the meat:  name, version, location, installdate, and uninstall string. 

Short Version:  Grouped by Program

 

#RequireAdmin
#include<Array.au3>

$iPid = run("powershell (Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | fl ProductName,InstallDate,InstalledLocation,ProductVersion,UninstallString | out-string).trim()", "" , @SW_HIDE , 0x2)

$sOutput = ""

 While ProcessExists($iPid)
        $sOutput &= StdoutRead($iPID)
 WEnd

$aOutput = stringsplit($sOutput, @LF , 2)
_ArrayDisplay($aOutput)

 

Long Version: Each Category in its own column, modular pieces.

 

;CIMClasses
#include<Array.au3>
#RequireAdmin

$iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select ProductName" , "" , @SW_HIDE , 0x2)

$sOutput = ""

 While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then
            ExitLoop
        EndIf
    WEnd

$aProductName = stringsplit($sOutput , @CR , 2)


;;;;;-------------------------------------------

$iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select InstallDate" , "" , @SW_HIDE , 0x2)

$sOutput = ""

 While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then
            ExitLoop
        EndIf
    WEnd

$aInstallDate = stringsplit($sOutput , @CR , 2)

;;;;;-------------------------------------------


$iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select InstalledLocation" , "" , @SW_HIDE , 0x2)

$sOutput = ""

 While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then
            ExitLoop
        EndIf
    WEnd

$aInstalledLocation = stringsplit($sOutput , @CR , 2)

;;;;;-------------------------------------------

$iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select ProductVersion" , "" , @SW_HIDE , 0x2)

$sOutput = ""

 While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then
            ExitLoop
        EndIf
    WEnd

$aProductVersion = stringsplit($sOutput , @CR , 2)

;;;;;-------------------------------------------

$iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select UninstallString" , "" , @SW_HIDE , 0x2)

$sOutput = ""

 While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then
            ExitLoop
        EndIf
    WEnd

$aUninstallString = stringsplit($sOutput , @CR , 2)

;;;;;-------------------------------------------


Local $aOut[ubound($aProductName)][5]

For $i = 0 to ubound($aProductName) - 1
    $aOut[$i][0] = $aProductName[$i]
    $aOut[$i][1] = $aInstallDate[$i]
    $aOut[$i][2] = $aInstalledLocation[$i]
    $aOut[$i][3] = $aProductVersion[$i]
    $aOut[$i][4] = $aUninstallString[$i]
Next

_ArrayDisplay($aOut , "SMS Installed Software")

 

Edited by iamtheky
added short form

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites



boththose I'm curious, why would you use AutoIt to use PowerShell to use WMI?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I am just awful at powershell, and these old WMI or registry queries is how I am forcing myself to learn.  Many of these are small slices of larger scripts that pool data from Splunk/Lancope/Forti*/etc...   AutoIt is my only real option for automating the manipulation of data into different formats from many different sources.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Does not format the output for me (running on window 10 pro x86) So why no use IEnumInstalledApps directly on AutoIt.

 

Saludos

 

 

Share this post


Link to post
Share on other sites

Does not format the output for me (running on window 10 pro x86) So why no use IEnumInstalledApps directly on AutoIt.

 

Saludos

 

 

Because the method  posted here requires "System Center Configuration Manager" installed. Most private users don't have that software, which means boththose probably uses machine which is part of some bigger system.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

So why no use IEnumInstalledApps directly on AutoIt.

I dont know how and a search for "IEnumInstalledApps" in the forums returns only your reply to this thread.

And I am on Win 8.1, PS 4.0.   And I am not doing any ps formatting on the long form, just reading arrays into an array, certainly odd if that fails.

 

Because the method  posted here requires "System Center Configuration Manager" installed

True that.  I will amend to reflect the prereq.

 

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

True that.  I will amend to reflect the prereq.

 

I'm sure you knew this, but doing it directly from AutoItwithout the PowerShell and using the same algo would be:

PrintBoththosesThingInAutoItWithoutUsingPowerShell()
ConsoleWrite("@error = " & @error & ", @extended = " & Hex(@extended) & @CRLF)

Func PrintBoththosesThingInAutoItWithoutUsingPowerShell()
    Local $oErrorHandler = ObjEvent("AutoIt.Error", PrintBoththosesThingInAutoItWithoutUsingPowerShell)
    Local $oWMIService = ObjGet("winmgmts:\\.\root\cimv2\sms") ; dot means "this comp"
    If @error Then Return SetError(1, @error, "")
    Local $oItems = $oWMIService.ExecQuery("SELECT ProductName,InstallDate,InstalledLocation,ProductVersion,UninstallString FROM SMS_InstalledSoftware")
    If @error Then Return SetError(2, @error, "")
    For $oItem In $oItems
        ConsoleWrite($oItem.ProductName & @CRLF)
        ConsoleWrite(@TAB & $oItem.InstallDate & @CRLF)
        ConsoleWrite(@TAB & $oItem.InstalledLocation & @CRLF)
        ConsoleWrite(@TAB & $oItem.ProductVersion & @CRLF)
        ConsoleWrite(@TAB & $oItem.UninstallString & @CRLF)
        ConsoleWrite(@CRLF)
    Next
EndFunc

That's why it wasn't clear to me why you used PowerShell.

2 people like this

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

ah yes, to answer that I have been on a powershell kick as of late due to projects for other business units.  Win 8 powershell made DISM stuff sexy, so being able to mount/apply/interrogate packages with a bunch of one liners would be useful for their future maintenance.

 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

... ...
 Local $oItems = $oWMIService.ExecQuery("SELECT ProductName,InstallDate,InstalledLocation,ProductVersion,UninstallString FROM SMS_InstalledSoftware")
... ...

How about Win32_Product
 

#include "Array.au3"

Opt("MustDeclareVars",1)
Opt("TrayIconDebug",1)
Opt("TrayAutoPause",0)
Global $_nice_COMerrorArray, $_nice_COMerrorObj
_nice_COMerrorHandler(1) ; COM error handler.

ToolTip("mouse over the trayicon for debug info.", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",1,4)

Local $a = _WMI_Win32_Product()
If @error Then
    MsgBox( 262144 ,"WMI Output","No WMI Objects Found for class: " & "Win32_Product" )
Else
    Switch @extended
        Case 0
            ToolTip("Done.", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",1,4)
        Case 1
            ToolTip("Nothing, you've got nothing."&@CR&@CR&"Adjust the query", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",2,4)
        Case 2
            ToolTip("More than you can chew."&@CR&@CR&"Adjust the ""$iLimit"" or the query", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",2,4)
    EndSwitch
    If $_nice_COMerrorArray[0][0] Then _nice_COMerrorHandler(2)
    _Array_Rotate2D( $a )
    _ArrayDisplay( $a ,"ScriptOMatic - ""Win32_Product""")
EndIf


Func _WMI_Win32_Product( $iLimit = 1000 , $sComputer = "." , $sUser = "" , $sPassword = "" )

    ; Generated by AutoIt ScriptOMatic

    ; Description: Instances of this class represent products as they are installed by MSI.
    ;          A product generally correlates to a single installation package.


    ; Class Methods:
    ;
    ; Install
    ; Admin
    ; Advertise
    ; Reinstall
    ; Upgrade
    ; Configure
    ; Uninstall


    Local $wbemFlagReturnImmediately = 0x10
    Local $wbemFlagForwardOnly = 0x20
    Local $colItems = ""
    Local $sReturn=""
    Local $iExt = 0
    If 1 > Int( $iLimit ) Then $iLimit = 1
    Local $aReturn[1000][ Int( $iLimit ) + 1]
    $aReturn[0][0] = 0
    $aReturn[0][1] = 0

    If $sComputer & $sUser & $sPassword = "." Then
        ToolTip("...ObjGet", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",1,4)
        Local $oWMIService = ObjGet("winmgmts:\\" & $sComputer & "\root\CIMV2")
    Else
        ToolTip("...ObjCreate", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",1,4)
        Local $wmiLocator = ObjCreate("WbemScripting.SWbemLocator")
        ToolTip("...ConnectServer", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",1,4)
        Local $oWMIService = $wmiLocator.ConnectServer($sComputer, "\root\CIMV2", $sUser, $sPassword)
    EndIf

    ToolTip("...ExecQuery", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",1,4)
    Local $colItems = $oWMIService.ExecQuery("SELECT * FROM Win32_Product", _
                         "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

    ToolTip("...ExecQuery executed."& @CR &"...waiting for data.", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",1,4)
    If IsObj($colItems) Then

        ; Class Properties: Names:
        ;

        $aReturn[  1 ][ 0 ] = "AssignmentType"
        $aReturn[  2 ][ 0 ] = "Caption"
        $aReturn[  3 ][ 0 ] = "Description"
        $aReturn[  4 ][ 0 ] = "HelpLink"
        $aReturn[  5 ][ 0 ] = "HelpTelephone"
        $aReturn[  6 ][ 0 ] = "IdentifyingNumber"
        $aReturn[  7 ][ 0 ] = "InstallDate"
        $aReturn[  8 ][ 0 ] = "InstallDate2"
        $aReturn[  9 ][ 0 ] = "InstallLocation"
        $aReturn[ 10 ][ 0 ] = "InstallSource"
        $aReturn[ 11 ][ 0 ] = "InstallState"
        $aReturn[ 12 ][ 0 ] = "Language"
        $aReturn[ 13 ][ 0 ] = "LocalPackage"
        $aReturn[ 14 ][ 0 ] = "Name"
        $aReturn[ 15 ][ 0 ] = "PackageCache"
        $aReturn[ 16 ][ 0 ] = "PackageCode"
        $aReturn[ 17 ][ 0 ] = "PackageName"
        $aReturn[ 18 ][ 0 ] = "ProductID"
        $aReturn[ 19 ][ 0 ] = "RegCompany"
        $aReturn[ 20 ][ 0 ] = "RegOwner"
        $aReturn[ 21 ][ 0 ] = "SKUNumber"
        $aReturn[ 22 ][ 0 ] = "Transforms"
        $aReturn[ 23 ][ 0 ] = "URLInfoAbout"
        $aReturn[ 24 ][ 0 ] = "URLUpdateInfo"
        $aReturn[ 25 ][ 0 ] = "Vendor"
        $aReturn[ 26 ][ 0 ] = "Version"
        $aReturn[ 27 ][ 0 ] = "WordCount"
        $aReturn[0][0] = 27
        For $objItem In $colItems
            $aReturn[0][1] = $aReturn[0][1] + 1
            If Not Mod( $aReturn[0][1] , 100 ) Then ToolTip("...adding "& $aReturn[0][1] &" of "&$iLimit &" ??", @DesktopWidth - 30,@DesktopHeight - 130, "ScriptOMatic - Win32_Product",1,4)
            If $aReturn[0][1] > $iLimit Then
                $iExt = 2
                ExitLoop
            EndIf

            ; Class Properties: Values:
            ;

            $aReturn[  1 ][ $aReturn[0][1] ] = $objItem.AssignmentType
            $aReturn[  2 ][ $aReturn[0][1] ] = $objItem.Caption
            $aReturn[  3 ][ $aReturn[0][1] ] = $objItem.Description
            $aReturn[  4 ][ $aReturn[0][1] ] = $objItem.HelpLink
            $aReturn[  5 ][ $aReturn[0][1] ] = $objItem.HelpTelephone
            $aReturn[  6 ][ $aReturn[0][1] ] = $objItem.IdentifyingNumber
            $aReturn[  7 ][ $aReturn[0][1] ] = $objItem.InstallDate
            $aReturn[  8 ][ $aReturn[0][1] ] = WMIDateStringToDate( $objItem.InstallDate2 )
            $aReturn[  9 ][ $aReturn[0][1] ] = $objItem.InstallLocation
            $aReturn[ 10 ][ $aReturn[0][1] ] = $objItem.InstallSource
            $aReturn[ 11 ][ $aReturn[0][1] ] = Win32_Product_PropertyValues_InstallState( $objItem.InstallState )
            $aReturn[ 12 ][ $aReturn[0][1] ] = $objItem.Language
            $aReturn[ 13 ][ $aReturn[0][1] ] = $objItem.LocalPackage
            $aReturn[ 14 ][ $aReturn[0][1] ] = $objItem.Name
            $aReturn[ 15 ][ $aReturn[0][1] ] = $objItem.PackageCache
            $aReturn[ 16 ][ $aReturn[0][1] ] = $objItem.PackageCode
            $aReturn[ 17 ][ $aReturn[0][1] ] = $objItem.PackageName
            $aReturn[ 18 ][ $aReturn[0][1] ] = $objItem.ProductID
            $aReturn[ 19 ][ $aReturn[0][1] ] = $objItem.RegCompany
            $aReturn[ 20 ][ $aReturn[0][1] ] = $objItem.RegOwner
            $aReturn[ 21 ][ $aReturn[0][1] ] = $objItem.SKUNumber
            $aReturn[ 22 ][ $aReturn[0][1] ] = $objItem.Transforms
            $aReturn[ 23 ][ $aReturn[0][1] ] = $objItem.URLInfoAbout
            $aReturn[ 24 ][ $aReturn[0][1] ] = $objItem.URLUpdateInfo
            $aReturn[ 25 ][ $aReturn[0][1] ] = $objItem.Vendor
            $aReturn[ 26 ][ $aReturn[0][1] ] = $objItem.Version
            $aReturn[ 27 ][ $aReturn[0][1] ] = $objItem.WordCount
        Next
        If $aReturn[0][1] = 0  Then $iExt = 1
        ReDim $aReturn[$aReturn[0][0] + 1][$aReturn[0][1] + 1]
        Return SetError( 0 , $iExt , $aReturn )
    Else
        ReDim $aReturn[1][2]
        Return SetError( 1 , 99 , $aReturn )
    EndIf
EndFunc

Func WMIDateStringToDate($dtmDate)
    Return (StringMid($dtmDate, 5, 2) & "/" & _
        StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
        & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc

Func _Array_Rotate2D(ByRef $a)
    Local $u1 = UBound($a, 1) - 1
    If @error Then Return SetError(1)
    Local $u2 = UBound($a, 2) - 1
    If @error Then
        Local $n, $m, $u2 = 1
        Local $b[$u2][$u1 + 1]
        For $n = 0 To $u1
            For $m = 0 To 0
                $b[$m][$n] = $a[$n]
            Next
        Next
    Else
        Local $n, $m
        Local $b[$u2 + 1][$u1 + 1]
        For $n = 0 To $u1
            For $m = 0 To $u2
                $b[$m][$n] = $a[$n][$m]
            Next
        Next
    EndIf
    $a = $b
EndFunc   ;==>_Array_Rotate2D


Func Win32_Product_PropertyValues_InstallState( $value )
    Switch $value
        Case "-6"
            Return "-6 = Bad Configuration"
        Case "-2"
            Return "-2 = Invalid Argument"
        Case "-1"
            Return "-1 = Unknown Package"
        Case "1"
            Return "1 = Advertised"
        Case "2"
            Return "2 = Absent"
        Case "5"
            Return "5 = Installed"
        Case Else
            Return $value&" = ???"
    EndSwitch
EndFunc


Func _nice_COMerrorHandler($i = 0)
    If $i == 1 Then
        Dim $_nice_COMerrorArray[301][9]
        $_nice_COMerrorArray[0][0] = 0
        $_nice_COMerrorObj = ObjEvent("AutoIt.Error", "_nice_COMerrorHandler")
        Return
    EndIf
    If $i == 2 Then
        If Not @Compiled Then
            Local $s = FileRead(@ScriptFullPath)
            Local $a = StringSplit($s, @CRLF, 1)
            For $s = 1 To $_nice_COMerrorArray[0][0]
                If Int($_nice_COMerrorArray[$s][7]) > $a[0] Then ContinueLoop
                $_nice_COMerrorArray[$s][8] = StringStripWS($a[Int($_nice_COMerrorArray[$s][7])], 3)
            Next
        EndIf
        ReDim $_nice_COMerrorArray[$_nice_COMerrorArray[0][0] + 1][9]
        _ArrayDisplay($_nice_COMerrorArray, "ScriptOMatic - COM Errors intercepted ( the script will continue after this screen )")
        Return
    EndIf
    If $_nice_COMerrorArray[0][0] = 300 Then
        $_nice_COMerrorArray[0][8] = "ScriptLine: only first 300 errors shown !!!"
        Return
    EndIf
    $i = $_nice_COMerrorArray[0][0] + 1
    $_nice_COMerrorArray[0][0] = $i
    $_nice_COMerrorArray[$i][1] = "0x" & Hex($_nice_COMerrorObj, 8)
    $_nice_COMerrorArray[$i][2] = $_nice_COMerrorObj.windescription
    $_nice_COMerrorArray[$i][3] = $_nice_COMerrorObj.source
    $_nice_COMerrorArray[$i][4] = $_nice_COMerrorObj.helpfile
    $_nice_COMerrorArray[$i][5] = $_nice_COMerrorObj.helpcontext
    $_nice_COMerrorArray[$i][6] = $_nice_COMerrorObj.lastdllerror
    $_nice_COMerrorArray[$i][7] = $_nice_COMerrorObj.scriptline
    If $i == 1 Then
        $_nice_COMerrorArray[0][1] = "ErrorNumber:"
        $_nice_COMerrorArray[0][2] = "WinDescription:"
        $_nice_COMerrorArray[0][3] = "Source:"
        $_nice_COMerrorArray[0][4] = "HelpFile:"
        $_nice_COMerrorArray[0][5] = "HelpContext:"
        $_nice_COMerrorArray[0][6] = "LastDLLerror:"
        $_nice_COMerrorArray[0][7] = "ScriptLineNumber:"
        $_nice_COMerrorArray[0][8] = "ScriptLine:"
    EndIf
EndFunc   ;==>_nice_COMerrorHandler


#comments-start

List of all the Properties and Methods for \root\CIMV2:Win32_Product


Win32_Product Class Qualifiers
------------------------------

1. Description = Instances of this class represent products as they are installed by MSI.  A product generally correlates to a single installation package.
2. dynamic = -1
3. Locale = 1033
4. MappingStrings = Microsoft.MSI
5. provider = MSIProv
6. SupportsUpdate = -1
7. UUID = {CE3324AA-DB34-11d2-85FC-0000F8102E5F}


Win32_Product Class Properties and Property Qualifiers
------------------------------------------------------

1. AssignmentType
1.1. CIMTYPE = uint16
1.2. Description = Assignment type of the product.
1.3. read = -1
1.4. Values = Per-user,Per-machine

2. Caption
2.1. CIMTYPE = string
2.2. Description = A short textual description (one-line string) for the Product.
2.3. MaxLen = 64
2.4. read = -1

3. Description
3.1. CIMTYPE = string
3.2. Description = A textual description of the product.
3.3. read = -1

4. HelpLink
4.1. CIMTYPE = string
4.2. Description = The support link for the product.
4.3. read = -1

5. HelpTelephone
5.1. CIMTYPE = string
5.2. Description = The support telephone for the product.
5.3. read = -1

6. IdentifyingNumber
6.1. CIMTYPE = string
6.2. Description = Product identification such as a serial number on software, a die number on a hardware chip, or (for non-commercial Products) a project number.
6.3. key = -1
6.4. MappingStrings = MIF.DMTF|ComponentID|001.4
6.5. MaxLen = 64
6.6. read = -1

7. InstallDate
7.1. CIMTYPE = string
7.2. DEPRECATED = -1
7.3. Description = The installation date.  The InstallDate property has been deprecated in favor of the InstallDate2 property which is of type DateTime rather than String. New implementations should use the InstallDate2 property.
7.4. read = -1

8. InstallDate2
8.1. CIMTYPE = datetime
8.2. Description = The InstallDate2 property represents the installation date of the product.
8.3. read = -1

9. InstallLocation
9.1. CIMTYPE = string
9.2. Description = The location of the installed product.
9.3. read = -1

10. InstallSource
10.1. CIMTYPE = string
10.2. Description = The installation source directory of the product.
10.3. read = -1

11. InstallState
11.1. CIMTYPE = sint16
11.2. Description = The installed state of the product.
11.3. read = -1
11.4. ValueMap = -6,-2,-1,1,2,5
11.5. Values = Bad Configuration,Invalid Argument,Unknown Package,Advertised,Absent,Installed

12. Language
12.1. CIMTYPE = string
12.2. Description = The language of the product.
12.3. read = -1

13. LocalPackage
13.1. CIMTYPE = string
13.2. Description = The location of the locally cached package for this product.
13.3. read = -1

14. Name
14.1. CIMTYPE = string
14.2. Description = Commonly used product name.
14.3. key = -1
14.4. MappingStrings = MIF.DMTF|ComponentID|001.2
14.5. MaxLen = 256
14.6. read = -1

15. PackageCache
15.1. CIMTYPE = string
15.2. Description = The location of the locally cached package for this product.
15.3. read = -1

16. PackageCode
16.1. CIMTYPE = string
16.2. Description = The identifier for the package from which this product was installed.
16.3. read = -1

17. PackageName
17.1. CIMTYPE = string
17.2. Description = The original package name for the product.
17.3. read = -1

18. ProductID
18.1. CIMTYPE = string
18.2. Description = The product ID.
18.3. read = -1

19. RegCompany
19.1. CIMTYPE = string
19.2. Description = The company registered to use the product.
19.3. read = -1

20. RegOwner
20.1. CIMTYPE = string
20.2. Description = The owner registered to use the product.
20.3. read = -1

21. SKUNumber
21.1. CIMTYPE = string
21.2. Description = Product SKU (stock keeping unit) information.
21.3. MaxLen = 64
21.4. read = -1

22. Transforms
22.1. CIMTYPE = string
22.2. Description = The transforms of the product.
22.3. read = -1

23. URLInfoAbout
23.1. CIMTYPE = string
23.2. Description = The URL information for the product.
23.3. read = -1

24. URLUpdateInfo
24.1. CIMTYPE = string
24.2. Description = The URL update information the product.
24.3. read = -1

25. Vendor
25.1. CIM_Key = -1
25.2. CIMTYPE = string
25.3. Description = The name of the Product's supplier, or entity selling the Product (the manufacturer, reseller, OEM, etc.). Corresponds to the Vendor property in the Product object in the DMTF Solution Exchange Standard.
25.4. MappingStrings = MIF.DMTF|ComponentID|001.1
25.5. MaxLen = 256
25.6. read = -1

26. Version
26.1. CIMTYPE = string
26.2. Description = Product version information.  Corresponds to the Version property in the product object in the DMTF Solution Exchange Standard.
26.3. key = -1
26.4. MappingStrings = MIF.DMTF|ComponentID|001.3
26.5. MaxLen = 64
26.6. read = -1

27. WordCount
27.1. CIMTYPE = uint32
27.2. Description = Summary information word count for the product
27.3. read = -1


Win32_Product Class Methods and Method Qualifiers
-------------------------------------------------

1. Install
1.1. Description = This method Will install an associated Win32_Product using the installation package provided through PackageLocation and any command line options that are supplied. The method can return the following values:
0 - Success.
2147549445 - RPC Server Fault Error. 
Other - For integer values other than those listed above, refer to the documentation on error codes returned by the Windows Installer API and the Win32 error codes.
1.2. Implemented = -1
1.3. static = -1
1.4. ValueMap = 0,2147549445,..
1.5. Values = Success,RPC Server Fault Error,Other

2. Admin
2.1. Description = This method will preform an administrative install of an associated Win32_Product using the installation package provided through PackageLocation and any command line options that are supplied. The method can return the following values:
0 - Success.
2147549445 - RPC Server Fault Error. 
Other - For integer values other than those listed above, refer to the documentation on error codes returned by the Windows Installer API and the Win32 error codes.
2.2. Implemented = -1
2.3. static = -1
2.4. ValueMap = 0,2147549445,..
2.5. Values = Success,RPC Server Fault Error,Other

3. Advertise
3.1. Description = This method will advertise an associated Win32_Product using the installation package provided through PackageLocation and any command line options that are supplied. The method can return the following values:
0 - Success.
2147549445 - RPC Server Fault Error. 
Other - For integer values other than those listed above, refer to the documentation on error codes returned by the Windows Installer API and the Win32 error codes.
3.2. Implemented = -1
3.3. static = -1
3.4. ValueMap = 0,2147549445,..
3.5. Values = Success,RPC Server Fault Error,Other

4. Reinstall
4.1. Description = This method will reinstall the associated instance of Win32_Product using the specified reinstallation mode. The method can return the following values:
0 - Success.
2147549445 - RPC Server Fault Error. 
Other - For integer values other than those listed above, refer to the documentation on error codes returned by the Windows Installer API and the Win32 error codes.
4.2. Implemented = -1
4.3. ValueMap = 0,2147549445,..
4.4. Values = Success,RPC Server Fault Error,Other

5. Upgrade
5.1. Description = This method will upgrade the associated Win32_Product using the upgrade package provided through PackageLocation and any command line options that are supplied. The method can return the following values:
0 - Success.
2147549445 - RPC Server Fault Error. 
Other - For integer values other than those listed above, refer to the documentation on error codes returned by the Windows Installer API and the Win32 error codes.
5.2. Implemented = -1
5.3. ValueMap = 0,2147549445,..
5.4. Values = Success,RPC Server Fault Error,Other

6. Configure
6.1. Description = This method will configure the associated instance of Win32_Product to the specified install state and level. The method can return the following values:
0 - Success.
2147549445 - RPC Server Fault Error. 
Other - For integer values other than those listed above, refer to the documentation on error codes returned by the Windows Installer API and the Win32 error codes.
6.2. Implemented = -1
6.3. ValueMap = 0,2147549445,..
6.4. Values = Success,RPC Server Fault Error,Other

7. Uninstall
7.1. Description = This method will uninstall the associated instance of Win32_Product. The method can return the following values:
0 - Success.
2147549445 - RPC Server Fault Error. 
Other - For integer values other than those listed above, refer to the documentation on error codes returned by the Windows Installer API and the Win32 error codes.
7.2. Implemented = -1
7.3. ValueMap = 0,2147549445,..
7.4. Values = Success,RPC Server Fault Error,Other

#Comments-End

 

Share this post


Link to post
Share on other sites

@boththose I meant this.

 

Saludos

 

1 person likes this

Share this post


Link to post
Share on other sites

That's awesome.  Seems faster than all the regread threads I played in.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • ur
      By ur
      I am maintaining all the reusable code in a separate file as library.au3.
      In that file I have referenced some dependent files using fileinstall, so that they will be extracted when necessary.
       
      Problem is, if I use a function in the library.au3 in another script which doesn't require this dependent file, as I am including the whole file using include tag, it is embedding that file also.
      Is there any way to exclude that.
       
    • david1337
      By david1337
      Hi guys,
      I need a little help here
      I have this simple Powershell script, that is able to set "sig.htm" as signature in OWA for the mail account specified.
      First part of the script just loads the Exchange snapin, since this is needed for the Get-Mailbox command.
      #Add Exchange 2010/2013 snapin if not already loaded in the PowerShell session if (!(Get-PSSnapin | where {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"})) { try { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction STOP } catch { #Snapin was not loaded Write-Warning $_.Exception.Message EXIT } . $env:ExchangeInstallPath\bin\RemoteExchange.ps1 Connect-ExchangeServer -auto -AllowClobber } $mailboxes = Get-Mailbox -Identity user@domain.com $mailboxes| foreach {$file= "sig.htm"; Set-MailboxMessageConfiguration -identity $_.alias -SignatureHtml "$(Get-Content -Path $file -ReadCount 0)"} What I want is for AutoIt to use Powershell.exe to run the script somehow. This way I would be able to use AutoIt variables and arrays together with the PS script.
       I guess the solution would be to run Powershell.exe with command line arguments?
      If that is not possible, maybe have the script stored as a "ps1" file, and interact with it that way? (not preferred)
    • tcox8
      By tcox8
      Hello,
      Currently I am running a script that calls a powershell script. To read the results of that I am reading StdOut. I am parsing things accordingly but unfortunately it doesn't parse correctly all the time and I end up missing parts of the string or other problems. My question then is, what is the best results for reading what is returned when running a powershell script or something similar?
    • WoodGrain
      By WoodGrain
      Hi guys,
      This is probably an obvious one, but I really don't use this command at all so am hoping you can spot my mistake.
      I'm running a powershell script on a schedule with the following script in a function, the function is being called in a loop, but the console process is not closing in the background and I end up with a bunch of console windows running in the background:
      Run(@comspec & ' /k PowerShell.exe -STA -NonInteractive -ExecutionPolicy ByPass -Command "& ''Z:\Powershell\365\GetNextDetails.ps1'' "', "", @SW_HIDE) Thanks!
    • caramen
      By caramen
      !Arf it i used [Start new topic] when i was in GUI section and the post was moved without i even noticed it. Can an admin move that to general (SORRY)!
       
      Hello guys ME again and my ugly english xD.
       
      This is the only one powershell command i am not able to use becose i dont found a way to insert the USERNAME $Variable at the first line. i am not able to find a third way to QUOTE a variable when i use "*" for the AutoIt command and the '*' for the PS command but i need to QUOTE inside the '*'PS command my $Variable
       
      $iPid = run("powershell get-aduser -Filter {sn -eq 'USERNAME'} -Properties sAMAccountName,Title" , @WindowsDir , @SW_HIDE , 0x2) $AllInfo = "" While 1 $AllInfo &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $AllInfo = stringsplit($AllInfo , @LF , 2) ;split result in all @LF but don't use the splitted result for anything _ArrayDisplay($AllInfo) This gonna be my last question becose i can do all the rest (i guess & wish ) alone