add BrowserKill to setup and delsub

This commit is contained in:
Mario Fetka 2019-10-16 18:28:41 +02:00
parent e63a3aa3b0
commit 3e037f3d4b
7 changed files with 83 additions and 0 deletions

View File

@ -0,0 +1,53 @@
; Opsi Builder to automate the creation of Opsi packages for the Opsi System
; Copyright (C) 2012 Daniel Schwager
; Copyright (C) 2014 Mario Fetka
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU Affero General Public License as
; published by the Free Software Foundation, either version 3 of the
; License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Affero General Public License for more details.
;
; You should have received a copy of the GNU Affero General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
[ExecWith_BrowserKill]
Option Explicit
KillBrowsers()
Sub KillBrowsers()
'Declare variables
Dim i
Dim wmiSvc,WQL,Processes,Process
Dim arrBrowserProcesses(9)
'Initialize variables
arrBrowserProcesses(0)="iexplore.exe"
arrBrowserProcesses(1)="chrome.exe"
arrBrowserProcesses(2)="firefox.exe"
arrBrowserProcesses(3)="safari.exe"
arrBrowserProcesses(4)="opera.exe"
arrBrowserProcesses(5)="vivaldi.exe"
arrBrowserProcesses(6)="iron.exe"
arrBrowserProcesses(7)="MicrosoftEdge.exe"
arrBrowserProcesses(8)="msedge.exe"
Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
For i = 0 To UBound(arrBrowserProcesses)
wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
Set processes = wmiSvc.ExecQuery(wql)
Do While processes.Count > 0
For Each process In processes
process.Terminate
Next
WScript.Sleep 200
Set processes = wmiSvc.ExecQuery(wql)
Loop
Next
End Sub

View File

@ -3,6 +3,8 @@
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
include_append "browserkill.opsiinc"
Set $UninstallProgram$ = $InstallDir$ + "\" + $UninstallExecutable$
Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini"
@ -44,6 +46,9 @@ if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
sub_check_exitcode
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall /32Bit

View File

@ -3,6 +3,7 @@
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
include_append "browserkill.opsiinc"
Set $UninstallProgram32$ = $InstallDir32$ + "\" + $UninstallExecutable32$
Set $IniFile32$ = $InstallDir32$ + "\opsi-" + $ProductId$ + ".ini"
@ -49,6 +50,8 @@ if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specif
sub_check_exitcode
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_32 /32Bit
comment "Cleanup registry"
@ -94,6 +97,8 @@ if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system spe
sub_check_exitcode
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall_64 /64Bit
comment "Cleanup registry"

View File

@ -3,6 +3,7 @@
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
include_append "browserkill.opsiinc"
Set $UninstallProgram$ = $InstallDir$ + "\" + $UninstallExecutable$
Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini"
@ -45,6 +46,9 @@ if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
sub_check_exitcode
endif
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Delete files"
Files_uninstall /64Bit

View File

@ -7,6 +7,8 @@
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
include_append "browserkill.opsiinc"
DefVar $MsiIdOld$
DefVar $UninstallProgram$
DefVar $UninstallProgramOld$
@ -84,6 +86,9 @@ else
comment "Copy files"
Files_install /32Bit
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Patch Registry"
Registry_install /32Bit

View File

@ -7,6 +7,8 @@
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
include_append "browserkill.opsiinc"
DefVar $MsiIdOld32$
DefVar $UninstallProgram32$
DefVar $UninstallProgramOld32$
@ -93,6 +95,8 @@ else
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_32
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Copy files"
Files_install_32 /32Bit
comment "Patch Registry"
@ -109,6 +113,8 @@ else
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install_64
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Copy files"
Files_install_64 /64Bit
comment "Patch Registry"

View File

@ -7,6 +7,8 @@
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off
include_append "browserkill.opsiinc"
DefVar $MsiIdOld$
DefVar $UninstallProgram$
DefVar $UninstallProgramOld$
@ -81,6 +83,9 @@ else
Winbatch_install
Sub_check_exitcode
;comment "Kill Web Browser"
;ExecWith_BrowserKill %System%\cscript.exe //b //nologo
comment "Copy files"
Files_install /64Bit