Inst. mit lokalem Admin - Admin-Account wird nicht erstellt

Nils
Beiträge: 185
Registriert: 16 Sep 2011, 08:59

Inst. mit lokalem Admin - Admin-Account wird nicht erstellt

Beitrag von Nils »

Hallo zusammen,

ich versuche mich gerade an der Erstellung eines Paktes für die Installation mit einem lokalen Admin-Account. Leider wird die Installation nicht korrekt vollständig durchgeführt. :?
Vorgegangen bin ich nach dem aktuellen Winst-Handbuch.
Die Installation läuft bis zu dem Punkt, an welchem per
NET USER opsiSetupAdmin $OpsiAdminPass$ /ADD
der Admin-Account angelegt werden soll. Hier kommt es zum Fehler "Zugriff verweigert".
Die selbe Meldung erscheint dann (natürlich) auch beim Versuch, den opsiSetupAdmin der Gruppe der Administratoren hinzuzufügen. Somit kann der Autologon nicht durchgeführt und auch die Installation nicht gestartet werden.
Getestet habe ich das Setup unter Windows XP (32 Bit).

Leider habe ich keine Idee, woran es liegen kann, dass es zu einem "Zugriff verweigert" kommt, wenn OPSI versucht, den lokalen Admin anzulegen. Der Aufruf des gleichen Befehls unter einem angemeldeten Admin-Account funktioniert ohne Fehler.

Und noch eine Frage am Rande: Was ist, wenn die Installation der Anwendung an sich ohne Adminrechte auskommt, bei der DE-Installation aber die Meldung erscheint, dass der Prozess "OPSI" oder "winst" beendet werden solle, um die Deinstallation fortsetzen zu können? "Reicht" es in diesem Fall, wenn die Anwendung per Admin-Account installiert wurde? Oder muss hier bei der Deinstallation auch noch etwas "angepasst" werden?

Vielen Dank im Voraus für eure Tipps und Hinweise. :)
Ich wünsche euch noch einen schönen und erfolgreichen Tag.
Viele Grüße
Nils
Benutzeravatar
Thomas_H
Beiträge: 525
Registriert: 09 Jun 2010, 11:57
Wohnort: Havelland

Re: Inst. mit lokalem Admin - Admin-Account wird nicht erste

Beitrag von Thomas_H »

Moinsens,

also wenn Du mittels winst-Script einen Admin-Account anlegen willst, wird das so erstmal nichts werden. Denn der opsi-Account an sich ist kein administrativer! Folglich muss ein NET-Befehl scheitern, wenn Du einen Admin anlegen willst.

Schau mal ins winst-Handbuch, Kapitel 3, vielleicht hilft Dir das. Mit entsprechenden Parametern kannst Du eine Anwendung auch als Admin ausführen.

Ausserdem gibt es ein Script im Wiki zum Thema Domainjoin welches unter Anlegung eines admins den Domainjoin durchführt.

Gruß

Thomas_H
Kennst Du schon die WIKI für OPSI-Scripte? Fertige Installationsscripte bekommen und ablegen unter OPSI-Wiki
Aus dem Glashaus :) : UIB bietet auch Schulungen und Supportverträge für Opsi an.
Bild
Nils
Beiträge: 185
Registriert: 16 Sep 2011, 08:59

Re: Inst. mit lokalem Admin - Admin-Account wird nicht erste

Beitrag von Nils »

Hallo Thomas,

vielen Dank für deine Hinweise. Ich hatte Kapitel 10.3 ("Skript für Installationen im Kontext eines lokalen Administrators") zu Rate gezogen.
Inzwischen habe ich festgestellt, dass unter Windows 7 (64 Bit) der Benutzer opsiSetupAdmin per "net user"-Befehl angelegt wird. Wobei ich eigentlich gerade unter Windows 7 auf Grund der UAC damit rechnete, dass der Benutzer nicht erstellt wird... Allerdings wird hier (also unter Windows 7) die eigentliche Installation noch nicht gestartet. Dies werde ich mir heute mal genauer ansehen.
Und bzgl. Windows XP werde ich mir, wie von dir empfohlen, noch Kapitel 3 sowie das Skript aus dem Wiki ansehen.

Nochmals vielen Dank und einen erfolgreichen Freitag.
Viele Grüße
Nils
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3327
Registriert: 04 Jun 2008, 14:27

Re: Inst. mit lokalem Admin - Admin-Account wird nicht erste

Beitrag von d.oertel »

Hi,

die Vorlage findest Du im Produkt opsi-template-with-admin

z.B. hier
http://download.uib.de/opsi4.0/products ... 1.0-8.opsi

gruss
d.oertel


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


Nils
Beiträge: 185
Registriert: 16 Sep 2011, 08:59

Re: Inst. mit lokalem Admin - Admin-Account wird nicht erste

Beitrag von Nils »

Hallo Herr Dr. Oertel,

vielen Dank für Ihren Hinweis. Diese Vorlage habe ich verwendet.
Derzeit stellt es sich so dar, dass die Installation unter Windows 7 (64 Bit) erfolgreich funktioniert. Leider jedoch nicht unter Windows XP (32 Bit). Hier erhalte ich in dem Schritt, in welchem der Admin-User angelegt werden soll, weiterhin die Meldung "Zugriff verweigert". :?

Für weitere Hinweise und Tipps danke ich im Voraus schon mal sehr.
Viele Grüße und noch einen schönen Tag.
Nils
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3327
Registriert: 04 Jun 2008, 14:27

Re: Inst. mit lokalem Admin - Admin-Account wird nicht erste

Beitrag von d.oertel »

Hi,

Dann ist da wohl eine Sicherheitsrichtlinie im Spiel.

Was soll denn da installiert werden ?
Was sind die Probleme bei einer 'normalen' Installation
In vielen Fällen hilft auch ein

Code: Alles auswählen

ChangeDirectory "%SCRIPTPATH%"
vor dem Winbatch call.

@Thomas_H:
Der opsi-client-agent läuft mit system Rechten. Das ist ein administrativer Account.
Auf XP als user pcpatch und ab NT6 direkt als SYSTEM.
Unter Win7 gibt es aber auch Prozesse die mit noch höheren (elevated) Rechten gestartet werden müssen.
Der Grund warum man hin und wieder den Trick mit dem opsi-template-with-admin braucht,
liegt in den Zugriffen auf das sonst nicht vorhandene lokale Profil.
Ansonsten vielen Dank für Dein Community Engagement !

gruss
d.oertel


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


Nils
Beiträge: 185
Registriert: 16 Sep 2011, 08:59

Re: Inst. mit lokalem Admin - Admin-Account wird nicht erste

Beitrag von Nils »

Hallo Herr Dr. Oertel,

vielen Dank für Ihre Nachricht.
Es geht um die Installation von IBM Lotus Notes 8.5.3. Das eigentliche Problem ist jedoch nicht die Installation sondern die DE-Installation. Hierbei kommt es immer zu der Meldung, dass die Anwendung "opsi-winst" beendet werden solle, um die Deinstallation fortsetzen zu können. Bei der Installation tritt diese Meldung nicht auf.
Ich dachte nun, dass, wenn ich die Anwendung per "template-with-admin" installiere, bei der Deinstallation diese Schwierigkeiten vielleicht nicht auftreten. Dies war aber einfach nur eine Vermutung, da ich keine Idee habe, was ich sonst machen kann, damit die o. g. Meldung nicht erscheint und die Deinstallation erfolgreich durchgeführt werden kann.

Über Systemsteuerung - Software lässt sich Notes übrigens auch nach einer Installation via opsi erfolgreich deinstallieren.

Vielen Dank für Ihre Tipps und Ihre Hilfe.
Sollten Sie weitere Infos benötigen, so lassen Sie mich dies gerne wissen.
Ich wünsche Ihnen einen angenehmen Tag und eine erfolgreiche Woche.
Viele Grüße
Nils
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3327
Registriert: 04 Jun 2008, 14:27

Re: Inst. mit lokalem Admin - Admin-Account wird nicht erste

Beitrag von d.oertel »

Hi,

mal das script posten .....

gruss
d.oertel


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


Nils
Beiträge: 185
Registriert: 16 Sep 2011, 08:59

Re: Inst. mit lokalem Admin - Admin-Account wird nicht erste

Beitrag von Nils »

Hallo Herr Dr. Oertel,

anbei die Skripte. Zunächst die Skripte der "normalen Version" (also ohne admin-template). Weiter unten die Skripte für die (De-)Installation im Kontext eines lokalen Admin.

setup.ins:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/

[Actions]
requiredWinstVersion >= "4.10.8.6"

DefVar $MsiId32$
DefVar $UninstallProgram32$
DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$

DefVar $Path$
set $Path$ = EnvVar ("Path")

Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")

Set $LogDir$ = "%SystemDrive%\tmp"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts, 
; no white space use '-' as a seperator
Set $ProductId$       = "Lotus Notes"
Set $MinimumSpace$    = "1 MB"
; the path were we find the product after the installation
Set $InstallDir32$      = "%ProgramFiles32Dir%\IBM\Lotus\Notes"
Set $InstallDir64$      = "%ProgramFiles64Dir%\IBM\Lotus\Notes"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------

if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError
	; Stop process and set installation status to failed
else
	comment "Show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
	
	; Deinstallation zur Zeit deaktiviert, wegen Problem bei Deinstallation unter Windows XP
	;if FileExists("%ScriptPath%\delsub.ins")
	;	comment "Start uninstall sub section"
	;	Sub "%ScriptPath%\delsub.ins"
	;endif
	
	if $LicenseRequired$ = "true"
		comment "Licensing required, reserve license and get license key"
		Sub_get_licensekey
	endif
	
	comment "installing"

	if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
		Message "Installing " + $ProductId$ + " 32 Bit..."
		comment "Start setup program"
		Winbatch_install_32
		Sub_check_exitcode
		;comment "Patch Registry"
		;Registry_install /32Bit
		set $InstallDir$ = $InstallDir64$
		Registry_PathPatch
		comment "Copy files"
		Files_install /32Bit
		;comment "Create shortcuts"
		;LinkFolder_install
	endif

	if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
		Message "Installing " + $ProductId$ + " 64 Bit..."
		comment "Start setup program"
		Winbatch_install_64
		Sub_check_exitcode
		;comment "Patch Registry"
		;Registry_install /64Bit
		set $InstallDir$ = $InstallDir32$
		Registry_PathPatch
		comment "Copy files"
		Files_install /64Bit
		;comment "Create shortcuts"
		;LinkFolder_install
	endif
	
endif

[Winbatch_install_32]
msiexec /qb! ALLUSERS=2 /i "%ScriptPath%\Lotus Notes 8.5.3.msi" TRANSFORMS="%ScriptPath%\LotusNotes8.5.3.mst" /L* "$LogDir$\NotesInstall.log" 


[Files_install]
copy -s "%ScriptPath%\files\*.*" "%CommonAppdataDir%\Lotus\Notes\Data\Shared\mui\de"

[Winbatch_install_64]
msiexec /qb! ALLUSERS=2 /i "%ScriptPath%\Lotus Notes 8.5.3.msi" TRANSFORMS="%ScriptPath%\LotusNotes8.5.3.mst" /L* "$LogDir$\NotesInstall.log" 


[Registry_PathPatch]
; Eintragen des Pfades zu Notes an den Anfang der Path-Variablen.
; Dies ist fuer die Nutzung des Octopus Desk 250 erforderlich
OpenKey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
set "Path" = "$InstallDir$;$Path$"

[LinkFolder_install]
; Creating a shortcut to the installed exe in AllUsers startmenu:
;
set_basefolder common_programs
set_subfolder $ProductId$

set_link
 	name: $ProductId$
 	target: "$InstallDir$\notes.exe"
 	parameters:
 	working_dir: $InstallDir$
 	icon_file: "$InstallDir$\notes.exe"
 	icon_index:
 end_link
;
; Creating a shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
 	name: $ProductId$
 	target: "$InstallDir$\notes.exe"
 	parameters: 
 	working_dir: $InstallDir$
 	icon_file: "$InstallDir$\notes.exe"
 	icon_index: 
end_link

[Sub_get_licensekey]
comment "License management is enabled and will be used"

comment "Trying to get a license key"
Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
; If there is an assignment of exactly one licensepool to the product the following call is possible:
; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use:
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)

DefVar $ServiceErrorClass$
set $ServiceErrorClass$ = getLastServiceErrorClass
comment "Error class: " + $ServiceErrorClass$

if $ServiceErrorClass$ = "None"
	comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
else
	if $ServiceErrorClass$ = "LicenseConfigurationError"
		LogError "Fatal: license configuration must be corrected"
		LogError getLastServiceErrorMessage
		isFatalError
	else 
		if $ServiceErrorClass$ = "LicenseMissingError"
			LogError "Fatal: required license is not supplied"
			isFatalError
		endif
	endif
endif

[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif
uninstall.ins:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/

[Actions]
requiredWinstVersion >= "4.10.8.6"

DefVar $MsiId32$
DefVar $UninstallProgram32$
DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$

DefVar $Path$
set $Path$ = EnvVar ("Path")

Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")

Set $LogDir$ = "%SystemDrive%\tmp"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "Lotus Notes"
Set $InstallDir32$    = "%ProgramFiles32Dir%\IBM\Lotus\Notes"
Set $InstallDir64$    = "%ProgramFiles64Dir%\IBM\Lotus\Notes"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------


comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$

Message "Uninstalling " + $ProductId$ + " ..."

if FileExists("%ScriptPath%\delsub.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub.ins"
endif

if $LicenseRequired$ = "true"
	comment "Licensing required, free license used"
	Sub_free_license
endif

[Sub_free_license]
comment "License management is enabled and will be used"

comment "Trying to free license used for the product"
DefVar $result$
Set $result$ = FreeLicense($LicensePool$)
; If there is an assignment of a license pool to the product, it is possible to use
; Set $result$ = FreeLicense("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)
delsup.ins:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/

DefStringList $Pfad$
DefVar $line$
DefVar $InstallDir$

Set $MsiId32$ = '{122A716C-63AD-4F73-BDCD-309F0A799C91}'
Set $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe"

Set $MsiId64$ = '{122A716C-63AD-4F73-BDCD-309F0A799C91}'
Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe"

if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
	Message "Uninstalling " + $ProductId$ + " 32 Bit..."

	if FileExists($UninstallProgram32$)
		comment "Uninstall program found, starting uninstall"
		Winbatch_uninstall_32
		sub_check_exitcode
		set $InstallDir$ = $InstallDir32$
		comment "Pfadanpassung von der Installation wieder rueckgaengig machen"
		DefVar $split$
		set $Pfad$ = splitString ($Path$, ";")
		for %s% in $Pfad$ do Sub_String_modifizieren
		set $Path$ = $line$
		comment "korrigierten Pfad wieder in Registry eintragen. Geaenderter Pfad wird nach Neustart des PC wirksam."
		Registry_uninstall /32Bit
	endif

	if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi_32
		sub_check_exitcode
		set $InstallDir$ = $InstallDir32$
		comment "Pfadanpassung von der Installation wieder rueckgaengig machen"
		DefVar $split$
		set $Pfad$ = splitString ($Path$, ";")
		for %s% in $Pfad$ do Sub_String_modifizieren
		set $Path$ = $line$
		comment "korrigierten Pfad wieder in Registry eintragen. Geaenderter Pfad wird nach Neustart des PC wirksam."
		Registry_uninstall /32Bit
	endif
endif

if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
	Message "Uninstalling " + $ProductId$ + " 64 Bit..."

	if FileExists($UninstallProgram64$)
		comment "Uninstall program found, starting uninstall"
		Winbatch_uninstall_64
		sub_check_exitcode
		set $InstallDir$ = $InstallDir64$
		comment "Pfadanpassung von der Installation wieder rueckgaengig machen"
		DefVar $split$
		set $Pfad$ = splitString ($Path$, ";")
		for %s% in $Pfad$ do Sub_String_modifizieren
		set $Path$ = $line$
		comment "korrigierten Pfad wieder in Registry eintragen. Geaenderter Pfad wird nach Neustart des PC wirksam."
		Registry_uninstall /64Bit
	endif

	if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi_64
		sub_check_exitcode
		set $InstallDir$ = $InstallDir32$
		comment "Pfadanpassung von der Installation wieder rueckgaengig machen"
		DefVar $split$
		set $Pfad$ = splitString ($Path$, ";")
		for %s% in $Pfad$ do Sub_String_modifizieren
		set $Path$ = $line$
		comment "korrigierten Pfad wieder in Registry eintragen. Geaenderter Pfad wird nach Neustart des PC wirksam."
		Registry_uninstall /64Bit
	endif
endif

comment "Delete program shortcuts"
LinkFolder_uninstall

[Winbatch_uninstall_32]

[Winbatch_uninstall_msi_32]
msiexec /x $MsiId32$ /qb! ALLUSERS=2 REBOOT=ReallySuppress

[Winbatch_uninstall_64]

[Winbatch_uninstall_msi_64]
msiexec /x $MsiId64$ /qb! ALLUSERS=2 REBOOT=ReallySuppress

[Sub_String_modifizieren]
set $split$ = "%s%"
if not ($split$ = "$InstallDir$")
		set $line$ = $line$ + $split$ + ";"
		if $line$ = ";"
			set $line$ = ""
		endif
	comment $line$
endif

[Registry_uninstall]
; Korrigierten Path wieder in Registry schreiben
OpenKey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
set "Path" = REG_EXPAND_SZ:'$Path$'


[LinkFolder_uninstall]
; Example of deleting a folder from AllUsers startmenu:
;
set_basefolder common_programs
delete_subfolder $ProductId$
;
; Example of deleting a shortcut from AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $ProductId$

[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif
---------------------------------------------------
Und nun die Skripte für die (De-)Installation im Kontext eines lokalen Adminaccounts.

setup.ins:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.

; TEMPLATE for
; Skript fuer Installationen im Kontext eines temporaeren lokalen Administrators
; installations as temporary local admin
; see winst_manual.pdf / winst_handbuch.pdf

; !!! requires winst32.exe version 4.2.x !!!

;
; !!! Das lokale Installations-Skript, das durch den temporaeren lokalen Admin ausgefuehrt wird
; !!! (sein Name steht in $LocalSetupScript$), muss mit dem Befehl  
; !!! exitWindows /Reboot
; !!! enden
; 

; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; Vorarbeiten/Voraussetzungen/Doku pruefen wie in Winsthandbuch
; 8.3 Skript fuer Installationen im Kontext eines lokalen Administrators
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


[Actions]
requiredWinstVersion >= 4.10.6
setLogLevel=7
DefVar $ProductName$
DefVar $ProductSizeMB$
DefVar $LocalSetupScript$
DefVar $LockKeyboard$
DefVar $OpsiAdminPass$
DefVar $OS$
DefVar $MinorOS$
DefVar $MsVersion$
DefVar $RebootFlag$
DefVar $ShutdownRequested$
DefVar $WinstRegKey$
DefVar $RebootRegVar$
DefVar $AutoName$
DefVar $AutoPass$
DefVar $AutoDom$
DefVar $AutoLogon$
DefVar $AutoBackupKey$
DefVar $LocalFilesPath$
DefVar $LocalWinst$
DefVar $SystemType$
DefVar $platform_cmdexe$
DefVar $DefaultLoglevel$
DefVar $PasswdLogLevel$
DefVar $AdminGroup$
DefVar $SearchResult$
DefVar $LocalDomain$

DefStringlist $ResultList$
DefStringlist $ResultList2$
DefStringlist $ResultList3$

comment "set $LockKeyboard$ to true to prevent user hacks while admin is logged in"
Set $LockKeyboard$="true"
Set $LockKeyboard$="false"
Set $ProductName$ = "Lotus Notes"
Set $ProductSizeMB$ = "1500"

Set $LocalSetupScript$ = "local_setup.ins"
set $OS$ = GetOS
set $MinorOS$ = GetNTVersion
Set $SystemType$ = GetSystemType
Set $MsVersion$ = GetMsVersionInfo
set $DefaultLoglevel$ = "7"
comment " set $PasswdLogLevel$ to 0 for production"
Set $PasswdLogLevel$="7"
SetLogLevel=$DefaultLoglevel$

if not (fileExists ("%Scriptpath%\psgetsid.exe"))
	LogError "psgetsid.exe is missing. Please install it from http://download.sysinternals.com/Files/PsTools.zip to %Scriptpath%"
	isFatalError
endif

if not(($SystemType$ = "64 Bit System") or ($SystemType$ = "x86 System"))
	LogError "Unknown Systemtype: "+$SystemType$+" - aborting"
	isFatalError
endif

if $SystemType$ = "64 Bit System"
	set $platform_cmdexe$ = "%SystemRoot%\cmd64.exe"
else
	set $platform_cmdexe$ = "%System%\cmd.exe"
endif

Set $LocalDomain$ = "%PCNAME%"
;if ($MsVersion$ >= "6")
;	Set $LocalDomain$ = "."
;endif

comment "handle Rebootflag"
Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst"
Set $RebootFlag$ = GetRegistryStringValue("["+$WinstRegKey$+"] "+"RebootFlag")
Set $ShutdownRequested$ = GetRegistryStringValue("["+$WinstRegKey$+"] "+"ShutdownRequested")

sub_test_autologon_data

comment "some paths required"
Set $AutoBackupKey$ = $WinstRegKey$+"\AutoLogonBackup"
Set $LocalFilesPath$ = "C:\opsi_local_inst"
Set $LocalWinst$ = "c:\opsi\utils\winst32.exe"
if not( FileExists($LocalWinst$) )
	Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\preloginloader\utils\winst32.exe"
endif
if not( FileExists($LocalWinst$) )
	Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\preloginloader\opsi-winst\winst32.exe"
endif
if not( FileExists($LocalWinst$) )
	Set $LocalWinst$ = "%ProgramFilesDir%\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
endif
if not( FileExists($LocalWinst$) )
	LogError "No opsi-winst found. Abborting."
	isFatalError
endif

comment "show product picture"
ShowBitmap /3 "%scriptpath%\localsetup\"+$ProductName$+".png" $ProductName$

if not (($RebootFlag$ = "1") or ($RebootFlag$ = "2") or ($RebootFlag$ = "3"))
	comment "Part before first Reboot"
	comment "just reboot - this must be done if this is the first product after OS installation"
	comment "handle Rebootflag"
	Set $RebootFlag$ = "1"
	Registry_SaveRebootFlag
	ExitWindows /ImmediateReboot
endif ; Rebootflag = not (1 or 2 or 3)

if $RebootFlag$ = "1"
	comment "Part before second Reboot"

	if not(HasMinimumSpace ("%SYSTEMDRIVE%", ""+$ProductSizeMB$+" MB"))
		LogError "Not enough space on drive C: . "+$ProductSizeMB$+" MB on C: required for "+$ProductName$
		isFatalError
	endif
	
	comment "Lets work..."
	Message "Preparing "+$ProductName$+" install step 1..."
	sub_Prepare_AutoLogon

	comment "we need to reboot now to be sure that the autologon work"
	comment "handle Rebootflag"
	Set $RebootFlag$ = "2"
	Registry_SaveRebootFlag
	sub_test_autologon_data
	ExitWindows /ImmediateReboot
endif ; Rebootflag = not (1 or 2)

if ($RebootFlag$ = "2")
	comment "Part after first Reboot"
	
	comment "handle Rebootflag"
	Set $RebootFlag$ = "3"
	Registry_SaveRebootFlag
	
	comment "Lets work..."
	Message "Preparing "+$ProductName$+" install step 2..."
	Registry_enable_keyboard /64bit
	comment "now let the autologon work"
	comment "it will stop with a reboot"
	ExitWindows /ImmediateLogout
endif ; Rebootflag = 2

if ($RebootFlag$ = "3")
	comment "Part after second Reboot"
	
	comment "handle Rebootflag"
	Set $RebootFlag$ = "0"
	Registry_SaveRebootFlag
	
	comment "Lets work..."
	Message "Cleanup "+$ProductName$+" install (step 3)..."
	sub_Restore_AutoLogon
	set $SearchResult$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] opsi_autologon_setup")
	if $SearchResult$ = $LocalWinst$+" "+$LocalFilesPath$+"\"+$LocalSetupScript$+" /batch"
		LogError "Localscript did not run. We remove the RunOnce entry and abort"
		Registry_del_runonce /64Bit
		isFatalError
	endif
	comment "This is the clean end of the installation"
endif ; Rebootflag = 3
ExitWindows /Reboot

[sub_Prepare_AutoLogon]
comment "copy the setup script and files"
Files_copy_Setup_files_local
comment "read actual Autologon values for backup"
set $AutoName$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultUserName")
comment "if AutoLogonName is our setup admin user, something bad happend"
comment "then let us cleanup"
if ($AutoName$="opsiSetupAdmin")
	set $AutoName$=""
	set $AutoPass$=""
	set $AutoDom$=""
	set $AutoLogon$="0"
else
	set $AutoPass$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultPassword")
	set $AutoDom$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultDomainName")
	set $AutoLogon$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] AutoAdminLogon")
endif

comment "backup AutoLogon values"
Registry_save_autologon

comment "prepare the admin AutoLogon"
SetLogLevel=$PasswdLogLevel$
set $OpsiAdminPass$= randomstr
Registry_autologon /64Bit

comment "get the name of the admin group"
comment "using psgetsid from sysinernals pstools"
set $ResultList$ = getOutStreamFromSection("DosInAnIcon_get_admin_group")
set $AdminGroup$ = takeString(6,$ResultList$)
set $AdminGroup$ = takeString(1,splitstring($AdminGroup$,"\"))
comment "create our setup admin user"
DosInAnIcon_makeadmin
SetLogLevel=$DefaultLoglevel$

comment "remove c:\tmp\winst.bat with password"
Files_remove_winst_bat

comment "store our setup script as run once"
Registry_runOnce /64Bit

comment "disable keyboard and mouse while the autologin admin works"
if ($LockKeyboard$="true")
	Registry_disable_keyboard /64Bit
endif

[sub_test_autologon_data]
set $AutoPass$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultPassword")
set $AutoDom$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] DefaultDomainName")
set $AutoLogon$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] AutoAdminLogon")

[sub_Restore_AutoLogon]
comment "read AutoLogon values from backup"
set $AutoName$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultUserName")
set $AutoPass$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultPassword")
set $AutoDom$ = GetRegistryStringValue("["+$AutoBackupKey$+"] DefaultDomainName")
set $AutoLogon$ = GetRegistryStringValue("["+$AutoBackupKey$+"] AutoAdminLogon")

comment "restore the values"
SetLogLevel = $PasswdLogLevel$
Registry_restore_autologon /64Bit
SetLogLevel = $DefaultLoglevel$
comment "delete our setup admin user"
DosInAnIcon_deleteadmin
comment "cleanup setup script, files and profiledir"
Files_delete_Setup_files_local
comment "delete profiledir"
DosInAnIcon_deleteprofile

[Registry_save_autologon]
openkey [$AutoBackupKey$]
set "DefaultUserName"="$AutoName$"
set "DefaultPassword"="$AutoPass$"
set "DefaultDomainName"="$AutoDom$"
set "AutoAdminLogon"="$AutoLogon$"

[Registry_restore_autologon]
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
set "DefaultUserName"="$AutoName$"
set "DefaultPassword"="$AutoPass$"
set "DefaultDomainName"="$AutoDom$"
set "AutoAdminLogon"="$AutoLogon$"

[DosInAnIcon_deleteadmin]
NET USER opsiSetupAdmin  /DELETE

[Registry_SaveRebootFlag]
openKey [$WinstRegKey$]
set "RebootFlag" = "$RebootFlag$"

[Files_copy_Setup_files_local]
copy -s %ScriptPath%\localsetup\*.* $LocalFilesPath$

[Files_delete_Setup_files_local]
delete -sf $LocalFilesPath$
; folgender Befehl funktioniert nicht vollständig, deshalb ist er zur Zeit auskommentier
; der Befehl wird durch die Sektion "DosInAnIcon_deleteprofile" ersetzt (P.Ohler)
;delete -sf "%ProfileDir%\opsiSetupAdmin"

[DosInAnIcon_deleteprofile]
rmdir /S /Q "%ProfileDir%\opsiSetupAdmin"

[DosInAnIcon_get_admin_group]
@echo off
"%ScriptPath%\psgetsid.exe" /accepteula S-1-5-32-544

[DosInAnIcon_makeadmin]
NET USER opsiSetupAdmin $OpsiAdminPass$ /ADD
NET LOCALGROUP $AdminGroup$ /ADD opsiSetupAdmin

[Registry_autologon]
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
set "DefaultUserName"="opsiSetupAdmin"
set "DefaultPassword"="$OpsiAdminPass$"
set "DefaultDomainName"="$LocalDomain$"
set "AutoAdminLogon"="1"

[Registry_runonce]
openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
set "opsi_autologon_setup"='"$LocalWinst$" "$LocalFilesPath$\$LocalSetupScript$" /batch'

[Registry_del_runonce]
openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
DeleteVar "opsi_autologon_setup"

[Registry_disable_keyboard]
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass]
set "Start"=REG_DWORD:0x4
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mouclass]
set "Start"=REG_DWORD:0x4

[Registry_enable_keyboard]
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass]
set "Start"=REG_DWORD:0x1
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mouclass]
set "Start"=REG_DWORD:0x1

[Files_remove_winst_bat]
delete -f c:\tmp\_winst.bat
local_setup.ins:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/

[Actions]
Registry_del_autologin
;....

requiredWinstVersion >= "4.10.8.6"

DefVar $MsiId32$
DefVar $UninstallProgram32$
DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$

DefVar $Path$
set $Path$ = EnvVar ("Path")

Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")

Set $LogDir$ = "%SystemDrive%\tmp"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts, 
; no white space use '-' as a seperator
Set $ProductId$       = "Lotus Notes"
Set $MinimumSpace$    = "1500 MB"
; the path were we find the product after the installation
Set $InstallDir32$      = "%ProgramFiles32Dir%\IBM\Lotus\Notes"
Set $InstallDir64$      = "%ProgramFiles64Dir%\IBM\Lotus\Notes"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------

if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError
	; Stop process and set installation status to failed
else
	comment "Show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
	
	; Deinstallation zur Zeit deaktiviert, wegen Problem bei Deinstallation unter Windows XP
	;if FileExists("%ScriptPath%\delsub.ins")
	;	comment "Start uninstall sub section"
	;	Sub "%ScriptPath%\delsub.ins"
	;endif
	
	if $LicenseRequired$ = "true"
		comment "Licensing required, reserve license and get license key"
		Sub_get_licensekey
	endif
	
	comment "installing"

	if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
		Message "Installing " + $ProductId$ + " 32 Bit..."
		comment "Start setup program"
		Winbatch_install_32
		Sub_check_exitcode
		set $InstallDir$ = $InstallDir64$
		Registry_PathPatch
		comment "Copy files"
		Files_install /32Bit
	endif

	if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
		Message "Installing " + $ProductId$ + " 64 Bit..."
		comment "Start setup program"
		Winbatch_install_64
		Sub_check_exitcode
		set $InstallDir$ = $InstallDir32$
		Registry_PathPatch
		comment "Copy files"
		Files_install /64Bit
	endif
	ExitWindows /Reboot
endif

[Registry_del_autologin]
openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
set "DefaultUserName"=""
set "DefaultPassword"=""

[Winbatch_install_32]
msiexec /qb! ALLUSERS=2 /i "%ScriptPath%\Lotus Notes 8.5.3.msi" TRANSFORMS="%ScriptPath%\LotusNotes8.5.3.mst" /L* "$LogDir$\NotesInstall.log" 


[Files_install]
copy -s "%ScriptPath%\files\*.*" "%CommonAppdataDir%\Lotus\Notes\Data\Shared\mui\de"

[Winbatch_install_64]
msiexec /qb! ALLUSERS=2 /i "%ScriptPath%\Lotus Notes 8.5.3.msi" TRANSFORMS="%ScriptPath%\LotusNotes8.5.3.mst" /L* "$LogDir$\NotesInstall.log" 

[Files_install_64]

[Registry_install]

[Registry_PathPatch]
; Eintragen des Pfades zu Notes an den Anfang der Path-Variablen.
; Dies ist fuer die Nutzung des Octopus Desk 250 erforderlich
OpenKey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
set "Path" = "$InstallDir$;$Path$"

[LinkFolder_install]
; Creating a shortcut to the installed exe in AllUsers startmenu:
;
set_basefolder common_programs
set_subfolder $ProductId$

set_link
 	name: $ProductId$
 	target: "$InstallDir$\notes.exe"
 	parameters:
 	working_dir: $InstallDir$
 	icon_file: "$InstallDir$\notes.exe"
 	icon_index:
 end_link
;
; Creating a shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
 	name: $ProductId$
 	target: "$InstallDir$\notes.exe"
 	parameters: 
 	working_dir: $InstallDir$
 	icon_file: "$InstallDir$\notes.exe"
 	icon_index: 
end_link

[Sub_get_licensekey]
comment "License management is enabled and will be used"

comment "Trying to get a license key"
Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
; If there is an assignment of exactly one licensepool to the product the following call is possible:
; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use:
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)

DefVar $ServiceErrorClass$
set $ServiceErrorClass$ = getLastServiceErrorClass
comment "Error class: " + $ServiceErrorClass$

if $ServiceErrorClass$ = "None"
	comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
else
	if $ServiceErrorClass$ = "LicenseConfigurationError"
		LogError "Fatal: license configuration must be corrected"
		LogError getLastServiceErrorMessage
		isFatalError
	else 
		if $ServiceErrorClass$ = "LicenseMissingError"
			LogError "Fatal: required license is not supplied"
			isFatalError
		endif
	endif
endif

[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif
uninstall.ins:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/

[Actions]
requiredWinstVersion >= "4.10.8.6"

DefVar $MsiId32$
DefVar $UninstallProgram32$
DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$

DefVar $Path$
set $Path$ = EnvVar ("Path")

Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")

Set $LogDir$ = "%SystemDrive%\tmp"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "Lotus Notes"
Set $InstallDir32$    = "%ProgramFiles32Dir%\IBM\Lotus\Notes"
Set $InstallDir64$    = "%ProgramFiles64Dir%\IBM\Lotus\Notes"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------


comment "Show product picture"
ShowBitmap "%ScriptPath%\localsetup\" + $ProductId$ + ".png" $ProductId$

Message "Uninstalling " + $ProductId$ + " ..."

if FileExists("%ScriptPath%\delsub.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub.ins"
endif

if $LicenseRequired$ = "true"
	comment "Licensing required, free license used"
	Sub_free_license
endif

[Sub_free_license]
comment "License management is enabled and will be used"

comment "Trying to free license used for the product"
DefVar $result$
Set $result$ = FreeLicense($LicensePool$)
; If there is an assignment of a license pool to the product, it is possible to use
; Set $result$ = FreeLicense("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)
delsub.ins:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/

DefStringList $Pfad$
DefVar $line$
DefVar $InstallDir$

Set $MsiId32$ = '{122A716C-63AD-4F73-BDCD-309F0A799C91}'
Set $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe"

Set $MsiId64$ = '{122A716C-63AD-4F73-BDCD-309F0A799C91}'
Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe"

if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
	Message "Uninstalling " + $ProductId$ + " 32 Bit..."

	if FileExists($UninstallProgram32$)
		comment "Uninstall program found, starting uninstall"
		Winbatch_uninstall_32
		sub_check_exitcode
		set $InstallDir$ = $InstallDir32$
		comment "Pfadanpassung von der Installation wieder rueckgaengig machen"
		DefVar $split$
		set $Pfad$ = splitString ($Path$, ";")
		for %s% in $Pfad$ do Sub_String_modifizieren
		set $Path$ = $line$
		comment "korrigierten Pfad wieder in Registry eintragen. Geaenderter Pfad wird nach Neustart des PC wirksam."
		Registry_uninstall /32Bit
	endif

	if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi_32
		sub_check_exitcode
		set $InstallDir$ = $InstallDir32$
		comment "Pfadanpassung von der Installation wieder rueckgaengig machen"
		DefVar $split$
		set $Pfad$ = splitString ($Path$, ";")
		for %s% in $Pfad$ do Sub_String_modifizieren
		set $Path$ = $line$
		comment "korrigierten Pfad wieder in Registry eintragen. Geaenderter Pfad wird nach Neustart des PC wirksam."
		Registry_uninstall /32Bit
	endif
	
	comment "Delete files"
	Files_uninstall_32 /32Bit
endif

if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
	Message "Uninstalling " + $ProductId$ + " 64 Bit..."

	if FileExists($UninstallProgram64$)
		comment "Uninstall program found, starting uninstall"
		Winbatch_uninstall_64
		sub_check_exitcode
		set $InstallDir$ = $InstallDir64$
		comment "Pfadanpassung von der Installation wieder rueckgaengig machen"
		DefVar $split$
		set $Pfad$ = splitString ($Path$, ";")
		for %s% in $Pfad$ do Sub_String_modifizieren
		set $Path$ = $line$
		comment "korrigierten Pfad wieder in Registry eintragen. Geaenderter Pfad wird nach Neustart des PC wirksam."
		Registry_uninstall /64Bit
	endif

	if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "")
		comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall"
		Winbatch_uninstall_msi_64
		sub_check_exitcode
		set $InstallDir$ = $InstallDir32$
		comment "Pfadanpassung von der Installation wieder rueckgaengig machen"
		DefVar $split$
		set $Pfad$ = splitString ($Path$, ";")
		for %s% in $Pfad$ do Sub_String_modifizieren
		set $Path$ = $line$
		comment "korrigierten Pfad wieder in Registry eintragen. Geaenderter Pfad wird nach Neustart des PC wirksam."
		Registry_uninstall /64Bit
	endif
	
	comment "Delete files"
	Files_uninstall_64 /64Bit
endif

comment "Delete program shortcuts"
LinkFolder_uninstall

[Winbatch_uninstall_32]

[Winbatch_uninstall_msi_32]
msiexec /x $MsiId32$ /qb! ALLUSERS=2 REBOOT=ReallySuppress

[Files_uninstall_32]
delete -sf "$InstallDir32$\"

[Winbatch_uninstall_64]

[Winbatch_uninstall_msi_64]
msiexec /x $MsiId64$ /qb! ALLUSERS=2 REBOOT=ReallySuppress

[Files_uninstall_64]
delete -sf "$InstallDir64$\"

[Sub_String_modifizieren]
set $split$ = "%s%"
if not ($split$ = "$InstallDir$")
		set $line$ = $line$ + $split$ + ";"
		if $line$ = ";"
			set $line$ = ""
		endif
	comment $line$
endif

[Registry_uninstall]
; Korrigierten Path wieder in Registry schreiben
OpenKey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
set "Path" = REG_EXPAND_SZ:'$Path$'


[LinkFolder_uninstall]
; Example of deleting a folder from AllUsers startmenu:
;
set_basefolder common_programs
delete_subfolder $ProductId$
;
; Example of deleting a shortcut from AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $ProductId$

[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif
Bei der Installation mit diesen Skripten erscheint unter Windows XP (32 Bit) im Log folgendes:
[5] [23.7.2012 11:45:42] Execution of DosInAnIcon_makeadmin
[6] [23.7.2012 11:45:42] c:\opsi.org\tmp\_winstbat_2.bat saved back
[6] [23.7.2012 11:45:42] Executing "cmd.exe" /C "c:\opsi.org\tmp\_winstbat_2.bat"
[6] [23.7.2012 11:45:42]
[6] [23.7.2012 11:45:42] output:
[6] [23.7.2012 11:45:42] --------------
[6] [23.7.2012 11:45:42]
[6] [23.7.2012 11:45:42] C:\WINDOWS\system32>NET USER opsiSetupAdmin I?u77S/i14 /ADD
[6] [23.7.2012 11:45:42] Zugriff verweigert
[6] [23.7.2012 11:45:42]
[6] [23.7.2012 11:45:42] C:\WINDOWS\system32>NET LOCALGROUP Administratoren /ADD opsiSetupAdmin
[6] [23.7.2012 11:45:42] Zugriff verweigert
[6] [23.7.2012 11:45:42]
[6] [23.7.2012 11:45:42] Delete "c:\opsi.org\tmp\_winstbat_*"
[6] [23.7.2012 11:45:42] Search "c:\opsi.org\tmp\"
[6] [23.7.2012 11:45:42] File "c:\opsi.org\tmp\_winstbat_2.bat"
[6] [23.7.2012 11:45:42] The file has been deleted
[1] [23.7.2012 11:45:42] LogLevel was 7
[1] [23.7.2012 11:45:42] LogLevel set to 7
Vielen herzlichen Dank für Ihre Bemühungen und Ihre Hilfe! :)
Viele Grüße und einen schönen Tag.
Nils
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3327
Registriert: 04 Jun 2008, 14:27

Re: Inst. mit lokalem Admin - Admin-Account wird nicht erste

Beitrag von d.oertel »

Hi,

wie schon erwähnt: Zum Thema 'Zugriff verweigert' kann ich nichts sagen, ausser das es nicht normal ist und wahrscheinlich hier eine Firmen spezifische Security Richtline eingreift.

Die Deinstallation von der Version 8.5.2 haben wir hier ohne Probleme (und ohne admin) hinbekommen.
Vielleicht mal mit '/qn' statt 'qb' probieren.

gruss
d.oertel


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


Antworten