Video Screencast Help

Setting Condition for ROOTDRIVE

Created: 14 Nov 2013 | 5 comments

Hi ALL,

I need to set a condition in my package from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion where:-

  1. If ProductName has a word "server" - o the rootdrive will be E:\.
  2. If not, the rootdrive is C:\.

Can you help?

Operating Systems:

Comments 5 CommentsJump to latest comment

VBScab's picture

I'd suggest creating a scripted Custom Action to read the registry entry, parse the name and then use Session.Property to set the ROOTDRIVE property.

Actually, I'd probably script a WMI query to query Win32_OperatingSystem. That returns most detail that you'd need to determine exactly what the OS is and it will be somewhat more robust than querying the registry.

There will be a quadzillion examples all over the web but I'd suggest computerperformance.com as the first stop.

Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.

EdT's picture

You can use the RegLocator table to read the registry key into a property and then a simple VBScript custom action to parse the resulting property value. Don't forget to make your check ignore the case of the string containing "server" in case it is "Server" in some instances.  You can set ROOTDRIVE to C:\ as the default value in the property table and then change it to E:\ if necessary via your custom action. WMI is indeed an option but I suspect it would be overkill in this scenario, which is quite simple.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

VBScab's picture

>overkill
I figured that, if the OP is going to the bother of scripting, he/she would undoubtedly have found the script sample which returns details of just about any flavour of Windows which has WMI :-)

I find it's usually best to cater - if one can - for most eventualities since, as we know, clients almost never say "Yeah, we know we said we only want to test for 'x' but we actually want to test for 'x.y.z' as well." Ha, ha, ha!

Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.

EdT's picture

Sure, but when clients are paying by the hour, it's their loss if they don't specify what they want from the outset<g>

You and I both know that some clients are harder to steer in the right direction than trying to shovel water uphill with a fork. Sometimes it's just easier to provide exactly what has been requested and then see what happens....

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

AngelD's picture

You could use a condition similar to

RegLocatorPropertyName ~>< "server"