DefVar  $reboot$
Set     $reboot$ = "false"

if ($sereby_dotnet1.1$ = "reinstall")
    if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E78BFA60-5393-4C38-82AB-E8019E464EB4}] DisplayName") = "")
        comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
        Winbatch_uninstall_msi_net11_deu_32
        sub_check_exitcode
    endif
    Winbatch_dotnet1.1_uninstall
    opsiservicecall_dotnet1.1_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_dotnet2.0$ = "reinstall")
    if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C314CE45-3392-3B73-B4E1-139CD41CA933}] DisplayName") = "")
        comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
        Winbatch_uninstall_msi_net20_deu_32
        sub_check_exitcode
    endif
    Winbatch_dotnet2.0_uninstall
    opsiservicecall_dotnet2.0_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_dotnet3.0$ = "reinstall")
    if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C2C284D2-6BD7-3B34-B0C5-B2CAED168DF7}] DisplayName") = "")
        comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
        Winbatch_uninstall_msi_net30_deu_32
        sub_check_exitcode
    endif
    Winbatch_dotnet3.0_uninstall
    opsiservicecall_dotnet3.0_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_dotnet3.5$ = "reinstall")
    if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{052FDD78-A6EA-3187-8386-C82F4CA3A929}] DisplayName") = "")
	comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
        Winbatch_uninstall_msi_net35_deu_32
        sub_check_exitcode
    endif
    Winbatch_dotnet3.5_uninstall
    opsiservicecall_dotnet3.5_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_dotnet4.0$ = "reinstall")
    if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C911A0C2-2236-3164-AA47-F2566C01AE5E}] DisplayName") = "")
        comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
        Winbatch_uninstall_msi_net40_extended_deu_32
        sub_check_exitcode
    endif
    if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F750C986-5310-3A5A-95F8-4EC71C8AC01C}] DisplayName") = "")
        comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
        Winbatch_uninstall_msi_net40_client_deu_32
        sub_check_exitcode
    endif
    Winbatch_dotnet4.0_uninstall
    opsiservicecall_dotnet4.0_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_dotnet4.5$ = "reinstall")
    Winbatch_dotnet4.5_uninstall
    opsiservicecall_dotnet4.5_uninstall
    Set $reboot$ = "true"
endif

; a reboot is requred after the .net cleanup so that further uninstalls can work
if ($reboot$ = "true")
    comment "uninstall done now force Reboot"
    ExitWindows /ImmediateReboot
endif

if ($sereby_msjsharp$ = "reinstall")
    Winbatch_msjsharp_uninstall
    opsiservicecall_msjsharp_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_silver$ = "reinstall")
    Winbatch_silver_uninstall
    opsiservicecall_silver_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_jre$ = "reinstall")
    Dosbatch_jre_uninstall
    opsiservicecall_jre_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_AdobeShock$ = "reinstall")
    Winbatch_AdobeShock_uninstall
    opsiservicecall_AdobeShock_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_basicruntimes$ = "reinstall")
    Winbatch_basicruntimes_uninstall
    opsiservicecall_basicruntimes_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_msdx9$ = "reinstall")
    Winbatch_msdx9_uninstall
    opsiservicecall_msdx9_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_msdxm$ = "reinstall")
    Winbatch_msdxm_uninstall
    opsiservicecall_msdxm_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_msvc$ = "reinstall")
    Winbatch_msvc_uninstall
    opsiservicecall_msvc_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_AdobeFlash$ = "reinstall")
    Winbatch_AdobeFlash_uninstall
    opsiservicecall_AdobeFlash_uninstall
    Set $reboot$ = "true"
endif
if ($sereby_AdobeAir$ = "reinstall")
    Winbatch_AdobeAir_uninstall
    opsiservicecall_AdobeAir_uninstall
    Set $reboot$ = "true"
endif

; and the final reboot after the uninstall is done
if ($reboot$ = "true")
    comment "uninstall done now force Reboot"
    ExitWindows /ImmediateReboot
endif

[Winbatch_dotnet1.1_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 1.1 /u"

[opsiservicecall_dotnet1.1_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_dotnet1.1",
"install",
"%opsiserviceUser%"
]

[Winbatch_dotnet2.0_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 2.0 /u"

[opsiservicecall_dotnet2.0_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_dotnet2.0",
"install",
"%opsiserviceUser%"
]

[Winbatch_dotnet3.0_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 3.0 /u"

[opsiservicecall_dotnet3.0_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_dotnet3.0",
"install",
"%opsiserviceUser%"
]

[Winbatch_dotnet3.5_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 3.5 /u"

[opsiservicecall_dotnet3.5_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_dotnet3.5",
"install",
"%opsiserviceUser%"
]

[Winbatch_dotnet4.0_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 4.0 /u"

[opsiservicecall_dotnet4.0_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_dotnet4.0",
"install",
"%opsiserviceUser%"
]

[Winbatch_dotnet4.5_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 4.5 /u"

[opsiservicecall_dotnet4.5_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_dotnet4.5",
"install",
"%opsiserviceUser%"
]

[Winbatch_msjsharp_uninstall]

[opsiservicecall_msjsharp_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_msjsharp",
"install",
"%opsiserviceUser%"
]

[Winbatch_silver_uninstall]
wmic product where caption='Microsoft Silverlight' call uninstall
; "%ScriptPath%\UnInstall\Package\Silverlight\CleanSilverlight.cmd"


[opsiservicecall_silver_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_silver",
"install",
"%opsiserviceUser%"
]

[DosBatch_jre_uninstall]
@echo off
rem copy "%ScriptPath%\UnInstall\Packages\JRE\JavaRa.*" "$LogDir$\"
rem $LogDir$\JavaRa.exe /SILENT /PURGE /UPDATEDEFS
cscript /nologo "%ScriptPath%\UnInstall\Packages\JRE\JavaUninstallScript.vbs" /keeponly

[opsiservicecall_jre_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_jre",
"install",
"%opsiserviceUser%"
]

[Winbatch_AdobeShock_uninstall]

[opsiservicecall_AdobeShock_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_AdobeShock",
"install",
"%opsiserviceUser%"
]

[Winbatch_basicruntimes_uninstall]

[opsiservicecall_basicruntimes_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_basicruntimes",
"install",
"%opsiserviceUser%"
]

[Winbatch_msdx9_uninstall]

[opsiservicecall_msdx9_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_msdx9",
"install",
"%opsiserviceUser%"
]

[Winbatch_msdxm_uninstall]

[opsiservicecall_msdxm_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_msdxm",
"install",
"%opsiserviceUser%"
]

[Winbatch_msvc_uninstall]

[opsiservicecall_msvc_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_msvc",
"install",
"%opsiserviceUser%"
]

[Winbatch_AdobeFlash_uninstall]
$UninstallFlashExe$ -uninstall

[opsiservicecall_AdobeFlash_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_AdobeFlash",
"install",
"%opsiserviceUser%"
]

[Winbatch_AdobeAir_uninstall]

[opsiservicecall_AdobeAir_uninstall]
"method": "setProductProperty"
"params": [
"$ProductId$",
"sereby_AdobeAir",
"install",
"%opsiserviceUser%"
]

; windows xp dotnet bug uninstall 
; uninstall all languages and then remove .net
[Winbatch_uninstall_msi_net35_deu_32]
msiexec /x {052FDD78-A6EA-3187-8386-C82F4CA3A929} /qb! REBOOT=ReallySuppress

[Winbatch_uninstall_msi_net30_deu_32]
msiexec /x {C2C284D2-6BD7-3B34-B0C5-B2CAED168DF7} /qb! REBOOT=ReallySuppress

[Winbatch_uninstall_msi_net20_deu_32]
msiexec /x {C314CE45-3392-3B73-B4E1-139CD41CA933} /qb! REBOOT=ReallySuppress

[Winbatch_uninstall_msi_net11_deu_32]
msiexec /x {E78BFA60-5393-4C38-82AB-E8019E464EB4} /qb! REBOOT=ReallySuppress

[Winbatch_uninstall_msi_net40_extended_deu_32]
msiexec /x {C911A0C2-2236-3164-AA47-F2566C01AE5E} /qb! REBOOT=ReallySuppress

[Winbatch_uninstall_msi_net40_client_deu_32]
msiexec /x {F750C986-5310-3A5A-95F8-4EC71C8AC01C} /qb! REBOOT=ReallySuppress


