This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
userspace:removemsi [2019/10/02 17:03] tobias created |
userspace:removemsi [2021/08/23 08:37] (current) |
||
---|---|---|---|
Line 6: | Line 6: | ||
**NOTE:** \\ | **NOTE:** \\ | ||
$result$ must be from Type " | $result$ must be from Type " | ||
+ | |||
+ | ====== Usage ====== | ||
+ | Check WINST Manual: \\ | ||
+ | [[https:// | ||
+ | [[https:// | ||
===== config ===== | ===== config ===== | ||
Line 29: | Line 34: | ||
[2] = All Products uninstalled | [2] = All Products uninstalled | ||
+ | ===== CODE ===== | ||
+ | < | ||
+ | DefFunc RemoveMSI(val $remove$ : string) : stringlist | ||
+ | DefStringList $msiidsAndDescription$ | ||
+ | DefStringList $transformList$ | ||
+ | DefVar $ID$ | ||
+ | DefVar $description$ | ||
+ | DefVar $ExitCode$ | ||
+ | |||
+ | set $msiidsAndDescription$ = loadTextFile (" | ||
+ | |||
+ | for %i% in $msiidsAndDescription$ do sub_extract_id_and_description | ||
+ | |||
+ | [sub_extract_id_and_description] | ||
+ | set $transformList$ = splitstring(" | ||
+ | |||
+ | set $Description$ = takestring(0, | ||
+ | set $ID$ = takestring(1, | ||
+ | set $transformList$ = emptylist($transformList$) | ||
+ | |||
+ | Message " | ||
+ | |||
+ | |||
+ | if not (GetRegistryStringValue32(" | ||
+ | comment "MSI id " + $ID$ + " found in registry, starting msiexec to uninstall" | ||
+ | Winbatch_uninstall_msi | ||
+ | sub_check_exitcode | ||
+ | endif | ||
+ | |||
+ | if not (GetRegistryStringValue64(" | ||
+ | comment "MSI id " + $ID + " found in registry, starting msiexec to uninstall" | ||
+ | Winbatch_uninstall_msi | ||
+ | sub_check_exitcode | ||
+ | endif | ||
+ | |||
+ | |||
+ | [Winbatch_uninstall_msi] | ||
+ | msiexec /x $ID$ /qb-! REBOOT=ReallySuppress | ||
+ | |||
+ | [sub_check_exitcode] | ||
+ | set $ExitCode$ = getLastExitCode | ||
+ | |||
+ | Switch $ExitCode$ | ||
+ | Case " | ||
+ | | ||
+ | set $result$ = emptylist($result$) | ||
+ | set $result$ = addToList($result$," | ||
+ | set $result$ = addToList($result$," | ||
+ | set $result$ = addToList($result$," | ||
+ | EndCase | ||
+ | case " | ||
+ | set $result$ = addToList($result$, | ||
+ | set $result$ = addToList($result$, | ||
+ | set $result$ = addToList($result$," | ||
+ | EndCase | ||
+ | case " | ||
+ | set $result$ = addToList($result$, | ||
+ | set $result$ = addToList($result$, | ||
+ | set $result$ = addToList($result$," | ||
+ | EndCase | ||
+ | case " | ||
+ | set $result$ = addToList($result$, | ||
+ | set $result$ = addToList($result$, | ||
+ | set $result$ = addToList($result$," | ||
+ | EndCase | ||
+ | DefaultCase | ||
+ | Message $exitcode$ | ||
+ | set $result$ = addToList($result$, | ||
+ | set $result$ = addToList($result$, | ||
+ | set $result$ = addToList($result$," | ||
+ | isFatalError | ||
+ | EndCase | ||
+ | | ||
+ | EndFunc | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | ===== Sample usage in delsub.opsiscript ===== | ||
+ | All MSI Software Packages defined in the msi.conf file will be removed. | ||
+ | |||
+ | < | ||
+ | importLib " | ||
+ | DefStringList $result$ | ||
+ | |||
+ | set $result$ = removeMSI(" | ||
+ | </ | ||
+ | ===== Questions, bug reports, feature request, or just an idea for new crazy functions ??? ===== | ||
+ | This Function is Part of my OPSI-WINST-LIBRARY Bundle, which home is on GitHUB.\\ | ||
+ | Feel free to share your Ideas for new functions or contact me there for bug reports. \\ | ||
+ | [[https:// |