User Tools

Site Tools


userspace:uninstaller

This is an old revision of the document!


Uninstaller

Uninstaller
23.11.2016

Script by Patrick Boschert
Comments and improvements welcome

  • Tested with opsi 4.0.6.3.5.1 2015/09/18
  • Tested with Winst Version 4.11.2.5
  • Tested with Windows 7 32\64bit

Für die Deinstallation von Software habe ich hier ein minimales Script mit der dazugehörigen Batch-Datei entworfen. Die Uninstall.ins kann jedem beliebigen Softwarepaket zugeführt werden.

Lediglich in der “uninstaller.cmd” ist der Teil “NAME_DER_ANWENDUNG_ODER_TEIL” anzupassen. Hier kann entweder der volle Name z.B. “Adobe Reader XI” oder nur “reader” angegeben werden. Die Batch durchsucht den PC dann nach installierter Software und deinstalliert diese.

Somit ist kein weiterer Code mehr notwendig. Getestet wurde die Deinstallation mit zahlreicher Software wie z.B. Adobe Reader, Microsoft Office, Frameworks, Mozilla Firefox, Google Chrome etc.

uninstall.ins

[Initial]
Message=Deinstalliere Adobe Reader
StayOnTop=false
 
[Aktionen]
DefVar $ProductId$ 
Set $ProductId$   = "Produktitle"
 
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
Files_copy /WaitSeconds 5
Winbatch_product_silent_uninstall /WaitSeconds 5
Files_delete
 
[Files_copy]
copy -s "%SCRIPTPATH%\uninstaller.cmd" "C:\opsi.org\tmp"
 
[Winbatch_product_silent_uninstall]
"C:\opsi.org\tmp\uninstaller.cmd"
 
[Files_delete]
del -sf "C:\opsi.org\tmp\uninstaller.cmd"

uninstaller.cmd

@echo off
	SETLOCAL EnableDelayedExpansion
	wmic product get name | findstr NAME_DER_ANWENDUNG_ODER_TEIL>tmp
	if not %errorlevel%==0 (
		del tmp
		goto exit
	)
	for /f "delims=*" %%1 in (tmp) do (
		del tmp
		set val=%%1
		set App=!val:  =!
		echo !App!
		echo wmic product where name="!App!" call uninstall>>un.bat
		)
	echo del %%0>>un.bat
	start cmd /c un.bat
	:exit
@echo on
userspace/uninstaller.1479886413.txt.gz · Last modified: 2021/08/23 08:37 (external edit)