Jump to content
Sign in to follow this  
iamtheky

Installed Software list - Ps + WMI + SCCM

Recommended Posts

*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

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

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.


♡♡♡

.

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

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Exit
      For my next project I would like to send files with "alternate data streams" by email in ZIP format.
      I can not use any external program like 7-Zip or WinRAR. (They would fit😥)
      Who knows how to create a ZIP file with "alternate data streams" included with the Powershell command "Compress-Archive"? 
      Here a test script:  (save as "ADSTester.cmd")
      @rem Try to create a zip file with alternate data streams (ADS) included @rem Housekeeping @cls @del ADSTester.zip >nul: @RD /S /Q Extracted >nul: @del ADSTester.txt >nul: @rem End of Housekeeping echo This is the ADSTester.txt file >ADSTester.txt echo This is the ADSTester.txt:Part1 file >ADSTester.txt:Part1 echo This is the ADSTester.txt:Part2 file >ADSTester.txt:Part2 dir /r ADSTester.txt @rem See the 3 files @rem **************************************************************** @rem **************************************************************** @rem Please alter the next lines to include the alternate data streams. powershell Compress-Archive -Path .\ADSTester.txt -Update -DestinationPath ADSTester.zip powershell Expand-Archive -Path ADSTester.zip -DestinationPath .\Extracted\ dir /r Extracted\ADSTester.txt @rem Only one file left :-( pause  
    • By ur
      Which Powershell command in the PowerCLI module for VMware ESX used to interact with UI apps?
       
      When I launch any exe/any exeutable using powercli on guest VM using powercli command.
      Invoke-VMScript, I am able to run them in the background but not in the foreground.
       
      i.e., UI apps are not launching but showing the background as running in the task manager.
       
      We need our UI Automation scripts to execute in the VM, but it is not working.
       
      We are able to do in virtualbox and hyper-v but not in vmware esx using powercli.
       
      Please suggest.
    • By ambad4u
      Hello and Good Day to All!
      I am trying to install .NET 3.5 on Windows 10 x64bit via autoit (via ShellExecuteWait + PowerShell).
      If I run this line, it will runs without issues:
      ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\OJP83BU523.ps1' & '"') "OJP83BU523.ps1" contains: DISM /Online /Enable-Feature /FeatureName:NetFX3 /All /Source:D:\Sources\sxs /LimitAccess
      However, since I won't know in advance the drive letter of the "sources" folder, I created a script to generate a PowerShell Script to give a correct path for it.
      With the modified script below, PowerShell only blinks and nothing happens
      ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\' & $filename & '"') or
      ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & $filename & '"')  
      I wish I know the difference with "$filename" and "\OJP83BU523.ps1" usage, as for me, it should be the same.
      Attached is my entire autoit script.
      any help is appreciated!, many thanks in advance!
      test.au3
    • By JLogan3o13
      There are a number of posts on the forum regarding use of Selenium in AutoIt. I recently had a go at using the PowerShell Selenium module, and was amazed at how easy it is. Thought I would post an example here; if anyone is interested this could probably be incorporated into AutoIt code pretty easily. 
      Pre-Req - The true star of this script is the ChroPath extension, available for Edge, Chrome and FireFox. With it installed, you just click on the element, select Inspect, and then ChroPath generates the XPath to the element for you. Here is an example based on a simple form I created on one of my sites.
      $myForm = Start-SeChrome -StartURL "http://logancomputerser.com/Appointment.html" -Maximized $firstName = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_First']" $lastName = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_Last']" $address = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_Street1']" $city = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_City']" $zip = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_Zip']" $state = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//select[@id='formElement_State']" $phoneDay = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_DaytimePhone']" $phoneNight = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_EveningPhone']" $email = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_liamE']" $user = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_48564']" $pw = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='formElement_f403c']" $submit = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='wstForm_Contact_Submit']" $reset = Find-SeElement -Driver $myForm -Timeout 30 -XPath "//input[@id='wstForm_Contact_Reset']" Send-SeKeys -Element $firstName -Keys "Joe" Send-SeKeys -Element $lastName -Keys "Blow" Send-SeKeys -Element $address -Keys "111 S. Main St." Send-SeKeys -Element $city -Keys "AnyCity" Send-SeKeys -Element $zip -Keys "90210" Send-SeKeys -Element $state -Keys "CA" Send-SeKeys -Element $phoneDay -Keys "555.867.5309" Send-SeKeys -Element $phoneNight -Keys "555.888.1212" Send-SeKeys -Element $email -Keys "1Adam12@gmail.com" Send-SeKeys -Element $user -Keys "JBlow" Send-SeKeys -Element $pw -Keys "MyPassword" Start-Sleep 1 Invoke-SeClick -Element $submit Stop-SeDriver -Driver $myForm  
      As mentioned, this is just another way to skin the cat, but I found it a pretty fast way to initiate some easy testing in Selenium, and have used it a couple of times in projects now, both straight through PowerShell and wrapped in AutoIt.
    • By antonioj84
      I need some help with the powershell code below
      #include <AutoItConstants.au3> #include <Array.au3> #RequireAdmin $PS='Get-NetConnectionProfile | Where-Object { $_.NetworkCategory -match "$Public" } | Set-NetConnectionProfile -NetworkCategory Private' $sCommands = "powershell -Command " & $PS &"" $iPID = Run(@ComSpec & " /k " & $sCommands, "", @SW_SHOW , $stdout_child)  
×
×
  • Create New...