Skip to main content
added 5507 characters in body
Source Link

. . . Function CleanUpTemp

            Dim f,sf,f1

            'remove temporary setup directories IXPxxx.TMP with Common.Stater.BootStrapper.exe and VSD*.tmp with PreCheck

            Set f = fso.GetFolder(WshShell.ExpandEnvironmentStrings("%TEMP%"))

            Set sf = f.SubFolders

            For Each f1 in sf

                           'do not remove files of current setup / date

                           If Not (StrComp(Left(f1.DateLastAccessed,10),Left(Now,10)) = 0 ) Then

                                           If (StrComp(Right(f1.name,4),".TMP") = 0 ) Then

                                                           If (StrComp(Left(f1.name,3),"IXP") = 0 ) Then

                                                                           If fso.FileExists(f1.Path + "\Common.Starter.BootStrapper.exe") Then

                                                                                          Show "Found " + f1.Path + "\Common.Starter.BootStrapper.exe",0

                                                                                          Show "Removing " + f1.Path,1

                                                                                          f1.Delete

                                                                           End If

                                                           End If

                                           Else

                                                           If (StrComp(Right(f1.name,4),".tmp") = 0 ) Then

                                                                           If (StrComp(Left(f1.name,3),"VSD") = 0) Then

                                                                                          If (fso.FolderExists(f1.Path + "\PreCheck")) Then

                                                                                                          Show "Found " + f1.Path + "\PreCheck",0

                                                                                                          Show "Removing " + f1.Path,1

                                                                                                          f1.Delete

                                                                                          End If

                                                                           End If

                                                           End IF

                                           End If

                           End if

            Next

End Function

Function CleanUpDir(directory)

            If fso.FolderExists(directory) Then

                           Show "Removing """ & directory & """ ...",1

                           WshShell.Run "cmd /c rmdir /s /q """ & directory & """",0,true

            End If

End Function

Function Show(msg,mode)

            'mode 0 - echo in cscript only, 1 - pop up for wscript,

            'mode 2 - MsgBox (ok/cancel) in wscript

            'mode 3 - MsgBox (yes/no) in wscript

            'mode 1,2 skip in /silent mode

            LogMsg msg

            If (Instr(WScript.FullName,"wscript.exe") > 0) Then

                           Select Case mode

                           Case 1:

                                           If Not (isSilent) Then

                                                           WshShell.PopUp msg,2, "Space Setup",64

                                           End If

                           Case 2: 'MsgBox 289 -> OK/Cancel

                                           If Not (isSilent) Then

                                                           If (MsgBox (msg,289,"Space Setup") = 2 ) Then

                                                                           LogMsg "Canceled by user"

                                                                           LogMsg "Removing client quit at " & Now & " <<<"

                                                                           WScript.Quit (1)

                                                           End If

                                           End If

                           Case 3:

                               If (noPrompt) Then

                                           LogMsg "Silent Unistallation triggered"

                                           else

                                                           'MsgBox 292 -> Yes/No

                                                           If (MsgBox (msg,292,"Space Setup") = 7 ) Then

                                                                           LogMsg "Canceled by user"

                                                                           LogMsg "Removing client quit at " & Now & " <<<"

                                                                           WScript.Quit (1)

                                                           End If

                                           End If

                           Case 4: 'MsgBox 64 -> Info OK

                                           MsgBox msg,64,"Space Setup"

. . . Function CleanUpTemp

            Dim f,sf,f1

            'remove temporary setup directories IXPxxx.TMP with Common.Stater.BootStrapper.exe and VSD*.tmp with PreCheck

            Set f = fso.GetFolder(WshShell.ExpandEnvironmentStrings("%TEMP%"))

            Set sf = f.SubFolders

            For Each f1 in sf

                           'do not remove files of current setup / date

                           If Not (StrComp(Left(f1.DateLastAccessed,10),Left(Now,10)) = 0 ) Then

                                           If (StrComp(Right(f1.name,4),".TMP") = 0 ) Then

                                                           If (StrComp(Left(f1.name,3),"IXP") = 0 ) Then

                                                                           If fso.FileExists(f1.Path + "\Common.Starter.BootStrapper.exe") Then

                                                                                          Show "Found " + f1.Path + "\Common.Starter.BootStrapper.exe",0

                                                                                          Show "Removing " + f1.Path,1

                                                                                          f1.Delete

                                                                           End If

                                                           End If

                                           Else

                                                           If (StrComp(Right(f1.name,4),".tmp") = 0 ) Then

                                                                           If (StrComp(Left(f1.name,3),"VSD") = 0) Then

                                                                                          If (fso.FolderExists(f1.Path + "\PreCheck")) Then

                                                                                                          Show "Found " + f1.Path + "\PreCheck",0

                                                                                                          Show "Removing " + f1.Path,1

                                                                                                          f1.Delete

                                                                                          End If

                                                                           End If

                                                           End IF

                                           End If

                           End if

            Next

End Function

Function CleanUpDir(directory)

            If fso.FolderExists(directory) Then

                           Show "Removing """ & directory & """ ...",1

                           WshShell.Run "cmd /c rmdir /s /q """ & directory & """",0,true

            End If

End Function

Function Show(msg,mode)

            'mode 0 - echo in cscript only, 1 - pop up for wscript,

            'mode 2 - MsgBox (ok/cancel) in wscript

            'mode 3 - MsgBox (yes/no) in wscript

            'mode 1,2 skip in /silent mode

            LogMsg msg

            If (Instr(WScript.FullName,"wscript.exe") > 0) Then

                           Select Case mode

                           Case 1:

                                           If Not (isSilent) Then

                                                           WshShell.PopUp msg,2, "Space Setup",64

                                           End If

                           Case 2: 'MsgBox 289 -> OK/Cancel

                                           If Not (isSilent) Then

                                                           If (MsgBox (msg,289,"Space Setup") = 2 ) Then

                                                                           LogMsg "Canceled by user"

                                                                           LogMsg "Removing client quit at " & Now & " <<<"

                                                                           WScript.Quit (1)

                                                           End If

                                           End If

                           Case 3:

                               If (noPrompt) Then

                                           LogMsg "Silent Unistallation triggered"

                                           else

                                                           'MsgBox 292 -> Yes/No

                                                           If (MsgBox (msg,292,"Space Setup") = 7 ) Then

                                                                           LogMsg "Canceled by user"

                                                                           LogMsg "Removing client quit at " & Now & " <<<"

                                                                           WScript.Quit (1)

                                                           End If

                                           End If

                           Case 4: 'MsgBox 64 -> Info OK

                                           MsgBox msg,64,"Space Setup"
added 4901 characters in body
Source Link

Dim product, products, version, ProductName, InstallLocation, RunCmd, InstallDir, Publisher

Dim ReturnStatus: ReturnStatus = 0

Dim LocalSetting, AppData, OSVersion

Dim ProgramFiles, ProgramFilesx86 : ProgramFilesx86 = Empty

Dim bfound : bfound = False

Dim bAdminRequired : bAdminRequired = False

Dim bCleanUp : bCleanup = True 'set to false if other products found in %ProgramFiles%

Dim UninstProducts(64,5) 'product, ProductName,Version, InstallLocation

Dim index: index = 0 'index for UninstProducts

Dim LocalProducts: LocalProducts = 0

Dim syngoInstallFolder

syngoInstallFolder = Left(WScript.ScriptFullname,InStr(1,WScript.ScriptFullname,"\Setup" & WScript.ScriptName,vbTextCompare))

'Show "Uninstall complete RTC",2

Show ">>> Start removing client at " & Now,0

Show "Computername: " + WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%"),0

Show "User: " + WshShell.ExpandEnvironmentStrings("%USERNAME%"),0

OSVersion = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")

Show "OS version " + OSVersion,0

If InStr (1,OSVersion, "6.",vbTextCompare) > 0 Then

            Rem registry key AppData used for NT 5.x does not exist any longer at least not on Server 2008 SP1

            Rem NT 6.0 does not localize "Local Settings" in file system (explorer only)

            LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

            Rem if CHARM 134372 is solved

            Rem LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") + "\AppData\Local"

            Rem directory Apps is used by AT boot strapper currently, even on NT 6

            AppData = LocalSetting + "\AppData\Local"

Else

            LocalSetting = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local Settings")

            AppData = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local AppData")

End If

ProgramFiles = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")

ProgramFilesx86 = WshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")

If (ProgramFilesx86 = "%ProgramFiles(x86)%") Then

            Rem environemnt not set -> 32 bit OS

            ProgramFilesx86 = Empty

End If

CheckAdmin

Err.Clear

Rem ------------------------------------------------

Rem call the CUS Uninstall firstly

Rem get a confirmation before

Rem ------------------------------------------------

If not bLocalOnly Then

            If isAdmin Then

              Show "You are going to uninstall  Space. Do you want to continue?",3

              dim ClientUpdateService: ClientUpdateService = Empty

              RunCmd = Empty

              if ( syngoInstallFolder <> Empty ) then

                ClientUpdateService = ClientInstallFolder + "bin\ClientBootstrapping.exe"

                if ( fso.FileExists(ClientUpdateService) ) Then

                  RunCmd = """" + ClientUpdateService + """" + " /UnInstall"

                end if

              end if



              Rem ------------------------------------

              Rem do the CUS call

             Rem ------------------------------------

              Dim iRet

              If ( RunCmd <> Empty ) Then

                           UninstallDCClient

                Show "Calling " & RunCmd,0

                             iRet = WshShell.Run(RunCmd,1,true)

                Show "Return status from Client Update Service = " & iRet,0

                If 0 = iRet Then

                  Show "Wait for ClientUpdateService processes to stop ...", 0

                  WaitForNoCUSRunning

                  Show "No ClientUpdateServices are running anymore", 0

                             Show "Remove %TEMP%\IXP*.TMP %TEMP%\VSD*.tmp",0 

                  CleanUpTemp

                End If

              else

                Show "No Client Update Service found"

              End If

            Else

                           If InStr (1,OSVersion, "6.",vbTextCompare) Then

                                           Show "Administrator rights are required to uninstall client" & vbLf &_

                                           "Please contact your administrator or use 'Run As Administrator'",4

                           Else

                                           Show "Administrator rights are required to uninstall client" & vbLf &_

                                           "Please contact your administrator",4

                           End If

            End If

End If

Dim product, products, version, ProductName, InstallLocation, RunCmd, InstallDir, Publisher

Dim ReturnStatus: ReturnStatus = 0

Dim LocalSetting, AppData, OSVersion

Dim ProgramFiles, ProgramFilesx86 : ProgramFilesx86 = Empty

Dim bfound : bfound = False

Dim bAdminRequired : bAdminRequired = False

Dim bCleanUp : bCleanup = True 'set to false if other products found in %ProgramFiles%

Dim UninstProducts(64,5) 'product, ProductName,Version, InstallLocation

Dim index: index = 0 'index for UninstProducts

Dim LocalProducts: LocalProducts = 0

Dim syngoInstallFolder

syngoInstallFolder = Left(WScript.ScriptFullname,InStr(1,WScript.ScriptFullname,"\Setup" & WScript.ScriptName,vbTextCompare))

'Show "Uninstall complete RTC",2

Show ">>> Start removing client at " & Now,0

Show "Computername: " + WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%"),0

Show "User: " + WshShell.ExpandEnvironmentStrings("%USERNAME%"),0

OSVersion = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")

Show "OS version " + OSVersion,0

If InStr (1,OSVersion, "6.",vbTextCompare) > 0 Then

            Rem registry key AppData used for NT 5.x does not exist any longer at least not on Server 2008 SP1

            Rem NT 6.0 does not localize "Local Settings" in file system (explorer only)

            LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

            Rem if CHARM 134372 is solved

            Rem LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") + "\AppData\Local"

            Rem directory Apps is used by AT boot strapper currently, even on NT 6

            AppData = LocalSetting + "\AppData\Local"

Else

            LocalSetting = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local Settings")

            AppData = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local AppData")

End If

ProgramFiles = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")

ProgramFilesx86 = WshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")

If (ProgramFilesx86 = "%ProgramFiles(x86)%") Then

            Rem environemnt not set -> 32 bit OS

            ProgramFilesx86 = Empty

End If

CheckAdmin

Err.Clear

Rem ------------------------------------------------

Rem call the CUS Uninstall firstly

Rem get a confirmation before

Rem ------------------------------------------------

If not bLocalOnly Then

            If isAdmin Then

              Show "You are going to uninstall  Space. Do you want to continue?",3

              dim ClientUpdateService: ClientUpdateService = Empty

              RunCmd = Empty

              if ( syngoInstallFolder <> Empty ) then

                ClientUpdateService = ClientInstallFolder + "bin\ClientBootstrapping.exe"

                if ( fso.FileExists(ClientUpdateService) ) Then

                  RunCmd = """" + ClientUpdateService + """" + " /UnInstall"

                end if

              end if



              Rem ------------------------------------

              Rem do the CUS call

             Rem ------------------------------------

              Dim iRet

              If ( RunCmd <> Empty ) Then

                           UninstallDCClient

                Show "Calling " & RunCmd,0

                             iRet = WshShell.Run(RunCmd,1,true)

                Show "Return status from Client Update Service = " & iRet,0

                If 0 = iRet Then

                  Show "Wait for ClientUpdateService processes to stop ...", 0

                  WaitForNoCUSRunning

                  Show "No ClientUpdateServices are running anymore", 0

                             Show "Remove %TEMP%\IXP*.TMP %TEMP%\VSD*.tmp",0 

                  CleanUpTemp

                End If

              else

                Show "No Client Update Service found"

              End If

            Else

                           If InStr (1,OSVersion, "6.",vbTextCompare) Then

                                           Show "Administrator rights are required to uninstall client" & vbLf &_

                                           "Please contact your administrator or use 'Run As Administrator'",4

                           Else

                                           Show "Administrator rights are required to uninstall client" & vbLf &_

                                           "Please contact your administrator",4

                           End If

            End If

End If

Post Closed as "Not suitable for this site" by dani-vta, user692942, gnat
formatted code
Source Link
Flakes
  • 2.4k
  • 8
  • 32
  • 36
Option Explicit

' Connect to Windows Installer object

' on error resume required for registry HKLM write check (isAdmin)

On Error Resume Next

Const ERROR_INSTALL_USEREXIT = 1602

Const ERROR_INSTALL_FAILURE = 1603

Const ReferencePublisher = "APL Sector"

 

Dim installer : installer = ""

Dim isAdmin

Dim isSilent: isSilent = True

Dim noPrompt: noPrompt = False

Dim bLocalOnly: bLocalOnly = False 'set to false with parameter /local

Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError

Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")

Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")

Dim argCount:argCount = Wscript.Arguments.Count

If (argCount > 0) Then

        If (StrComp(WScript.Arguments(0),"/verbose",vbTextCompare) = 0) Then

                       isSilent = False

        ElseIf (StrComp(WScript.Arguments(0),"/noPrompt",vbTextCompare) = 0) Then

                       noPrompt = True   

        Else If (StrComp(WScript.Arguments(0),"/local",vbTextCompare) = 0) Then

                       bLocalOnly = True

            Else

                   WScript.Echo "Script removes all APL products installed in" & vbLf &_

                                                                    "APL directory of local user profile" & vbLf &_

                                                                    "and 32 bit client from %Program Files%"

                   WScript.Quit 0

            End If

        End If

End If

Dim product, products, version, ProductName, InstallLocation, RunCmd, InstallDir, Publisher

Dim ReturnStatus: ReturnStatus = 0

Dim LocalSetting, AppData, OSVersion

Dim ProgramFiles, ProgramFilesx86 : ProgramFilesx86 = Empty

Dim bfound : bfound = False

Dim bAdminRequired : bAdminRequired = False

Dim bCleanUp : bCleanup = True 'set to false if other products found in %ProgramFiles%

Dim UninstProducts(64,5) 'product, ProductName,Version, InstallLocation

Dim index: index = 0 'index for UninstProducts

Dim LocalProducts: LocalProducts = 0

Dim APLInstallFolder

APLInstallFolder = Left(WScript.ScriptFullname,InStr(1,WScript.ScriptFullname,"\Setup\" & WScript.ScriptName,vbTextCompare))

'Show "Uninstall complete APL RTC",2

Show ">>> Start removing client at " & Now,0

Show "Computername: " + WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%"),0

Show "User: " + WshShell.ExpandEnvironmentStrings("%USERNAME%"),0

OSVersion = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")

Show "OS version " + OSVersion,0

If InStr (1,OSVersion, "6.",vbTextCompare) > 0 Then

        Rem registry key AppData used for NT 5.x does not exist any longer at least not on Server 2008 SP1

        Rem NT 6.0 does not localize "Local Settings" in file system (explorer only)

        LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

        Rem if CHARM 134372 is solved

        Rem LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") + "\AppData\Local"

        Rem directory Apps is used by AT boot strapper currently, even on NT 6

        AppData = LocalSetting + "\AppData\Local"

Else

        LocalSetting = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local Settings")

        AppData = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local AppData")

End If

ProgramFiles = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")

ProgramFilesx86 = WshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")

If (ProgramFilesx86 = "%ProgramFiles(x86)%") Then

        Rem environemnt not set -> 32 bit OS

        ProgramFilesx86 = Empty
Option Explicit

' Connect to Windows Installer object

' on error resume required for registry HKLM write check (isAdmin)

On Error Resume Next

Const ERROR_INSTALL_USEREXIT = 1602

Const ERROR_INSTALL_FAILURE = 1603

Const ReferencePublisher = "APL Sector"

 

Dim installer : installer = ""

Dim isAdmin

Dim isSilent: isSilent = True

Dim noPrompt: noPrompt = False

Dim bLocalOnly: bLocalOnly = False 'set to false with parameter /local

Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError

Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")

Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")

Dim argCount:argCount = Wscript.Arguments.Count

If (argCount > 0) Then

        If (StrComp(WScript.Arguments(0),"/verbose",vbTextCompare) = 0) Then

                       isSilent = False

        ElseIf (StrComp(WScript.Arguments(0),"/noPrompt",vbTextCompare) = 0) Then

                       noPrompt = True   

        Else If (StrComp(WScript.Arguments(0),"/local",vbTextCompare) = 0) Then

                       bLocalOnly = True

            Else

                   WScript.Echo "Script removes all APL products installed in" & vbLf &_

                                                                    "APL directory of local user profile" & vbLf &_

                                                                    "and 32 bit client from %Program Files%"

                   WScript.Quit 0

            End If

        End If

End If

Dim product, products, version, ProductName, InstallLocation, RunCmd, InstallDir, Publisher

Dim ReturnStatus: ReturnStatus = 0

Dim LocalSetting, AppData, OSVersion

Dim ProgramFiles, ProgramFilesx86 : ProgramFilesx86 = Empty

Dim bfound : bfound = False

Dim bAdminRequired : bAdminRequired = False

Dim bCleanUp : bCleanup = True 'set to false if other products found in %ProgramFiles%

Dim UninstProducts(64,5) 'product, ProductName,Version, InstallLocation

Dim index: index = 0 'index for UninstProducts

Dim LocalProducts: LocalProducts = 0

Dim APLInstallFolder

APLInstallFolder = Left(WScript.ScriptFullname,InStr(1,WScript.ScriptFullname,"\Setup\" & WScript.ScriptName,vbTextCompare))

'Show "Uninstall complete APL RTC",2

Show ">>> Start removing client at " & Now,0

Show "Computername: " + WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%"),0

Show "User: " + WshShell.ExpandEnvironmentStrings("%USERNAME%"),0

OSVersion = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")

Show "OS version " + OSVersion,0

If InStr (1,OSVersion, "6.",vbTextCompare) > 0 Then

        Rem registry key AppData used for NT 5.x does not exist any longer at least not on Server 2008 SP1

        Rem NT 6.0 does not localize "Local Settings" in file system (explorer only)

        LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

        Rem if CHARM 134372 is solved

        Rem LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") + "\AppData\Local"

        Rem directory Apps is used by AT boot strapper currently, even on NT 6

        AppData = LocalSetting + "\AppData\Local"

Else

        LocalSetting = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local Settings")

        AppData = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local AppData")

End If

ProgramFiles = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")

ProgramFilesx86 = WshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")

If (ProgramFilesx86 = "%ProgramFiles(x86)%") Then

        Rem environemnt not set -> 32 bit OS

        ProgramFilesx86 = Empty
Option Explicit

' Connect to Windows Installer object

' on error resume required for registry HKLM write check (isAdmin)

On Error Resume Next

Const ERROR_INSTALL_USEREXIT = 1602

Const ERROR_INSTALL_FAILURE = 1603

Const ReferencePublisher = "APL Sector"

 

Dim installer : installer = ""

Dim isAdmin

Dim isSilent: isSilent = True

Dim noPrompt: noPrompt = False

Dim bLocalOnly: bLocalOnly = False 'set to false with parameter /local

Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError

Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")

Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")

Dim argCount:argCount = Wscript.Arguments.Count

If (argCount > 0) Then

    If (StrComp(WScript.Arguments(0),"/verbose",vbTextCompare) = 0) Then

                   isSilent = False

    ElseIf (StrComp(WScript.Arguments(0),"/noPrompt",vbTextCompare) = 0) Then

                   noPrompt = True   

    Else If (StrComp(WScript.Arguments(0),"/local",vbTextCompare) = 0) Then

                   bLocalOnly = True

        Else

               WScript.Echo "Script removes all APL products installed in" & vbLf &_

                                                                "APL directory of local user profile" & vbLf &_

                                                                "and 32 bit client from %Program Files%"

               WScript.Quit 0

        End If

    End If

End If

Dim product, products, version, ProductName, InstallLocation, RunCmd, InstallDir, Publisher

Dim ReturnStatus: ReturnStatus = 0

Dim LocalSetting, AppData, OSVersion

Dim ProgramFiles, ProgramFilesx86 : ProgramFilesx86 = Empty

Dim bfound : bfound = False

Dim bAdminRequired : bAdminRequired = False

Dim bCleanUp : bCleanup = True 'set to false if other products found in %ProgramFiles%

Dim UninstProducts(64,5) 'product, ProductName,Version, InstallLocation

Dim index: index = 0 'index for UninstProducts

Dim LocalProducts: LocalProducts = 0

Dim APLInstallFolder

APLInstallFolder = Left(WScript.ScriptFullname,InStr(1,WScript.ScriptFullname,"\Setup\" & WScript.ScriptName,vbTextCompare))

'Show "Uninstall complete APL RTC",2

Show ">>> Start removing client at " & Now,0

Show "Computername: " + WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%"),0

Show "User: " + WshShell.ExpandEnvironmentStrings("%USERNAME%"),0

OSVersion = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")

Show "OS version " + OSVersion,0

If InStr (1,OSVersion, "6.",vbTextCompare) > 0 Then

    Rem registry key AppData used for NT 5.x does not exist any longer at least not on Server 2008 SP1

    Rem NT 6.0 does not localize "Local Settings" in file system (explorer only)

    LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

    Rem if CHARM 134372 is solved

    Rem LocalSetting = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") + "\AppData\Local"

    Rem directory Apps is used by AT boot strapper currently, even on NT 6

    AppData = LocalSetting + "\AppData\Local"

Else

    LocalSetting = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local Settings")

    AppData = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local AppData")

End If

ProgramFiles = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")

ProgramFilesx86 = WshShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")

If (ProgramFilesx86 = "%ProgramFiles(x86)%") Then

    Rem environemnt not set -> 32 bit OS

    ProgramFilesx86 = Empty
formatted code
Source Link
Flakes
  • 2.4k
  • 8
  • 32
  • 36
Loading
added 4057 characters in body
Source Link
Loading
Source Link
Loading