Hi,

I was just asked for help with this, so I'm interpreting the request. an associate of mine is looking for an "environment variable" in the "system variables" on a machine that he can set to look for the first CD drive. I've been googling this without success for the past hour. Anyone know what it would be? I'm guessing something like %ROOT_CDROM% or something to that .

Any help would be greatly appreciated.

Thanks!
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Try This;
***************** FindCD.vbs *******************************
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives

For Each objDrive In colDrives
If objDrive.DriveType = 4 then
CDROM = objDrive.DriveLetter & Chr(58) & Chr(92) '":\"
WScript.Echo cdrom
End If
Next
******************* End Code ********************************

Regards,
Answered 09/30/2004 by: Robo Scripter
Orange Senior Belt

Please log in to comment
0
Thanks. However I don't think that will work in a path statement.. Do you know if there is a %variable% for default CD Drive?
Answered 09/30/2004 by: daveinmn
Senior Yellow Belt

Please log in to comment
0
No, there is no environment variable.
Answered 09/30/2004 by: kkaminsk
Ninth Degree Black Belt

Please log in to comment
0
There is not one to my knownedge, else I would think that the vbscript would just call the system environment object via WIN32_Environment in WMI.

If you were to use WMI then you could simply use the WIN32_CDROMDrive object.
But if your doing a straight DOS read then I don't think there is a way to get this information.

Of course one could modify the FindCD VBS to create a %CDROM% system environment varible, if that is what the requester is after.


Regards,
Answered 09/30/2004 by: Robo Scripter
Orange Senior Belt

Please log in to comment
0
OK here's my response from the requester... does this help?

Not an environmental variable, some type of compiler variable that loads a value based on a registry value. I know it's in there and I can get it with Installmaster, just don't know how to do it in a msi.


Thanks again for all the help. I can package, but I am no software developer.
Answered 09/30/2004 by: daveinmn
Senior Yellow Belt

Please log in to comment
0
In Install Master:

Use the following.

Get System Information

set the Retrive to "First CD-ROM Drive"

Regards,
Answered 09/30/2004 by: Robo Scripter
Orange Senior Belt

Please log in to comment
0
He knows that :) He looking for away to produce the same result without any 3rd party intervention.

Thanks!
Answered 09/30/2004 by: daveinmn
Senior Yellow Belt

Please log in to comment
0
Hi!

I need to set an INI file value to a number representing the first CD-Drive's letter. E: would be 4, F: would be 5, G: would be 6 and so on. So i modified your VBS to look like this:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives

For Each objDrive In colDrives
If objDrive.DriveType = 4 then
CDROM = CDROM & objDrive.DriveLetter
End If
Next
CDROM = ASC(CDROM) - 65


It runs through all drives adding the driveletters to CDROM. The ASC function only looks at the first character in a string so it automatically returns the number of the first CD drive even if more than one drive is present. The 65 is subtracted to get a number according to the scheme described above.

My question is: How do I get the value of CDROM into the INI file or into a property so I can use this to set the INI file value?
I've tried using session.property("FirstCDRom") = CDROM (of course I've created the property first) but this way I get an error 1720.

Thanks in advance

Trent
Answered 01/31/2005 by: Trent_R
Yellow Belt

Please log in to comment
0
I believe this was covered a while back on altiris.com/support/forum

Do a search on INI, property. Basically you run VB code directly in the MSI script so that it'll create a property and the property will be available to set other values.
Answered 02/01/2005 by: aogilmor
Ninth Degree Black Belt

Please log in to comment
0
Well, getting the value from the property into the INI wasn't the hard part. It was more like getting the value from the VBScript variable into the property. I finally figured it out myself. It's the position of the custom action in the sequence that either causes those installer errors (I had errors 1720 and 2762) or makes it work.
As it seems it only allows setting the property after CostFinalize and before InstallInitialize (maybe there are other positions as well).

Still I'd like to thank you for your efforts and the URL you posted. Every source of information is valuable [:D]
Answered 02/02/2005 by: Trent_R
Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity