A new Flexera Community experience is coming on November 18th, click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

exception blues

I've written a .vbs custom action to check what DVD-Writer drive is on the machine and I want to quit the installer if it doesn't have the Sony DVD drive. (this is for Nero6 OEM which was bundled with sony drives)

any idea how to quit the install if it doesn't meet the requirements?

here's my code so far..

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("localhost")
For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_CDROMDrive", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
WScript.Echo objItem.Caption
Next
Next
(5) Replies
For an overview, what I normally do is create a custom action and schedule it prior to LaunchCondition. Have the CA set a property flag and have launchconditions check for that flag to continue or otherwise dispay an message and quit the install.

Your script looks way off without actually trying to run it. First thing I notice is your WScript reference. That won't fly in a script custom action since its not running in WScript, it's running in ActiveScript.
Try this:

On Error Resume Next

Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colDRIVES = objWMIService.ExecQuery("SELECT * FROM Win32_CDROMDrive" )

For Each Drive In colDrives
If InStr( UCase( Drive.Caption ), "SONY" ) then
Session.Property("SONYFOUND")="1"
End If
Next
thanks for that, the script runs OK now.. but I don't think I have it quite right.

I've installed the CA as a vbscript stored in binary table, then I added in the launchcondition table the following: Condition: SONYFOUND=1

this fails misserably, sorry to bug you about this but I'm not sure how to set this condition propperly in the LaunchCondition table.
I'd appreciate the help very much.
Make sure the script custom action is sequenced with immediate execution prior to the launchcondition action. If you want generate a log file and post it here.
It works!! 🙂
You're right, didn't have the sequence correct.. check, check, doublecheck... 😉