This shows you the differences between two versions of the page.
userspace:removemsi [2019/10/02 17:05] tobias |
userspace:removemsi [2021/08/23 08:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== removeMSI ====== | ||
- | |||
- | **CALL:** | ||
- | < | ||
- | |||
- | **NOTE:** \\ | ||
- | $result$ must be from Type " | ||
- | |||
- | ===== config ===== | ||
- | Create a file named msi.conf in your %ScriptDir% \\ | ||
- | In this file, you have to include all MSIIDs you want to remove in the following format: \\ | ||
- | Desciption of your Software: | ||
- | For example: | ||
- | < | ||
- | |||
- | |||
- | ===== Retrurn StringList ===== | ||
- | You will get the following information back (in case of an error): | ||
- | |||
- | [0] = Description\\ | ||
- | [1] = ExitCode\\ | ||
- | [2] = Error Desciption (If known, otherwise UNKNOWN)\\ | ||
- | |||
- | |||
- | In case of ExitCode 0, 1605, 1641 or 3010 you will only get the following Information back: | ||
- | |||
- | [0] = All Products uninstalled\\ | ||
- | [1] = 0\\ | ||
- | [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 | ||
- | |||
- | |||
- | </ | ||
- | |||