/build/static/layout/Breadcrumb_cap_w.png

Root CD Drive

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

Answers (10)

Posted by: Robo Scripter 19 years ago
Orange Senior Belt
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,
Posted by: daveinmn 19 years ago
Senior Yellow Belt
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?
Posted by: kkaminsk 19 years ago
9th Degree Black Belt
0
No, there is no environment variable.
Posted by: Robo Scripter 19 years ago
Orange Senior Belt
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,
Posted by: daveinmn 19 years ago
Senior Yellow Belt
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.
Posted by: Robo Scripter 19 years ago
Orange Senior Belt
0
In Install Master:

Use the following.

Get System Information

set the Retrive to "First CD-ROM Drive"

Regards,
Posted by: daveinmn 19 years ago
Senior Yellow Belt
0
He knows that :) He looking for away to produce the same result without any 3rd party intervention.

Thanks!
Posted by: Trent_R 19 years ago
Yellow Belt
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
Posted by: aogilmor 19 years ago
9th Degree Black Belt
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.
Posted by: Trent_R 19 years ago
Yellow Belt
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]
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ