Seite 1 von 1

Returning the installation results

Verfasst: 10 Mär 2009, 18:04
von cshields
I've noticed in a couple of instances that an msi installation freezes or fails yet OPSI marks it as "Installed". Is there a way to script a success or failure result variable or something similar in the winst script to better inform OPSI of the installation status?

TIA!
-Corey

Re: Returning the installation results

Verfasst: 10 Mär 2009, 18:45
von d.oertel
Hi cshields,

yes, you should check the success of the installation.
If the installation is failed, you should call:
isFatalError
which stops the execution of the script and returns a 'failed' as installation state.

For examples see our script template:
http://download.uib.de/opsi3.3/produkte ... 1.0-7.opsi
or test the exit code of a winbatch call (opsi-winst manual):
– getLastExitCode
returns the ExitCode – also called ErrorLevel – of the last winbatch call
see also:
http://msdn.microsoft.com/en-us/library/aa368542.aspx
http://msdn.microsoft.com/en-us/library ... S.85).aspx

does this help ?

regards
detlef oertel

Re: Returning the installation results

Verfasst: 15 Mär 2009, 02:10
von cshields
Yes, this is what I'm looking for, thanks..

wInst can test for FileExists but is there a way to test for the existence of a registry key? I don't see such a boolean described in the wInst manual. I wouldn't want to rely on a file existence alone, but for some packages the combination of a file and a registry key would be a nice test. (something from HKLM\software\Microsoft\Windows\CurrentVersion\Uninstall would be a sure bet)

If there isn't such a test I could get by with a DosBatch call that dumps results to a file and then check with LineExistsIn. Something akin to RegistryExists would be pretty nice though.

Cheers!
-Corey

Re: Returning the installation results

Verfasst: 15 Mär 2009, 11:24
von r.roeder
cshields hat geschrieben:
a way to test for the existence of a registry key?
HKLM\software\Microsoft\Windows\CurrentVersion\Uninstall would be a sure bet)
GetRegistryStringValue ([HKLM\software\Microsoft\Windows\CurrentVersion\Uninstall] xy)

tries to read the value belonging to the entry xy in key HKML\...

If there is no such an entry the function returns the empty string (cf. winst manual 6.3.7).

I hope, this is sufficient as an existence test (although the same result is produced if the key exists but the value indeed is the empty string).

Greetings,

Rupert


Hi Corey,

Re: Returning the installation results

Verfasst: 23 Mär 2009, 01:11
von cshields
This worked perfectly! Assigned the registry to a variable and then just checked for equality within that variable.

Thanks for the tip!