Hallo,
ich möchte mit OPSI gerne einen Ordner und all seine Inhalte auf einem Client (Windows 7) löschen, aber irgendetwas mache ich wohl falsch.
Mein Skript sieht wie folgt aus:
[Actions]
WinBatch_Deinstallation
Ordner_loeschen
[WinBatch_Deinstallation]
"%ProgramFiles32Dir%\name_des_zu_deinstallierenden_programms\unins000.exe" /silent /norestart
[Ordner_loeschen]
rmdir -f "%ProgramFiles32Dir%\name_des_zu_deinstallierenden_programms\"
Der 1. Teil unter [WinBatch_Deinstallation] wird auch korrekt ausgeführt und das Programm wird deinstalliert. Allerdings liegen im Programmverzeichnis noch weitere Benutzerdateien, die durch die normale Deinstallationsroutine nicht gelöscht werden. Daher soll über den 2. Teil [Ordner_loeschen] der gesamte Ordner und seine Inhalte nach der Deinstallation gelöscht werden.
Wenn ich das Skript in dieser Form ausführe, erhalte ich auf dem Client von OPSI heraus die Fehlermeldung "Section Actions (Command in Line 3): Ordner_loeschen undefined". D.h. ich habe in meinem Skript offenbar einen Fehler drin.
Hat jemand eine Idee, wo der Fehler ist?
Btw, ich habe auch schon folgende Zeilen im Skript getestet:
[Ordner_loeschen]
del -f "%ProgramFiles32Dir%\name_des_zu_deinstallierenden_programms\"
[Ordner_loeschen]
delete -f "%ProgramFiles32Dir%\name_des_zu_deinstallierenden_programms\"
In beiden Fällen erscheint die gleiche Fehlermeldung.
Vielen Dank im Voraus für alle Tipps.
Gruß
Joker
Ordner löschen mit OPSI
-
- Beiträge: 650
- Registriert: 21 Feb 2012, 12:03
- Wohnort: Mainz
Re: Ordner löschen mit OPSI
Mach aus Ordner_loeschen mal DosBatch_Ordner_loeschen.
- SisterOfMercy
- Beiträge: 1556
- Registriert: 22 Jun 2012, 19:18
Re: Ordner löschen mit OPSI
Look at the templates, this will give you an idea of what to do.
I think you need to correctly name the secondary parts. If you want to remove files via the normal opsi method, use something that begins with Files, like in this example.
The delete method is a bit older, and you should be using del (read the winst manual) but this is just an example.
I think you need to correctly name the secondary parts. If you want to remove files via the normal opsi method, use something that begins with Files, like in this example.
The delete method is a bit older, and you should be using del (read the winst manual) but this is just an example.
Code: Alles auswählen
[Actions]
DefVar $INST_SystemType$
DefVar $InstallDir32$
DefVar $InstallDir64$
Set $INST_SystemType$ = GetSystemType
Set $ProductId$ = "opsi-template"
; the path were we find the product after the installation
Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
if ($INST_SystemType$ = "x86 System")
comment "Delete files"
Files_uninstall_32 /32Bit
Files_uninstall_AllProfiles /AllNtUserProfiles
endif
if ($INST_SystemType$ = "64 Bit System")
comment "Delete files"
Files_uninstall_64 /64Bit
Files_uninstall_AllProfiles /AllNtUserProfiles
endif
[Files_uninstall_32]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
delete -sf "$InstallDir32$\"
[Files_uninstall_64]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
delete -sf "$InstallDir64$\"
[Files_uninstall_AllProfiles]
delete -sf "%UserProfileDir%\Application Data\$ProductId$\"
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Re: Ordner löschen mit OPSI
Vielen Dank, jetzt funktioniert es.
Thank you very much, now it works perfect.
Gruß / Greetings
Joker
Thank you very much, now it works perfect.
Gruß / Greetings
Joker