MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Plug and Play Drivers[Next]: Hiding Sensitive Information
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Domain Specific Installation or Configuration

Domain Specific Installation or Configuration

The follow shows how to get the domain information into a property which could be used in the condition of some components to vary configuration or to determine if you should proceed with the install:

;--- Get domain information into a property ---------------------------------
#define DOMAIN_PROPERTY      FULL_DOMAIN_NAME
#define DOMAIN_PROPERTY.VBS  Setup_<$DOMAIN_PROPERTY>.vbs
<$VbsCa Binary="<$DOMAIN_PROPERTY.VBS>">                                ;;Version 08.288
#( '<?NewLine>'
   <$VbsCaEntry "SetProperty">
       CaDebug 1, "Determining the domain this computer belongs to..."
       dim oSystemInfo : set oSystemInfo = CaMkObject("AdSystemInfo")   ;;This could fail you may want a specific/better error message...
       CaDebug 0, "ComputerName  : " & oSystemInfo.ComputerName         ;;Fully Qualified Computer Name (LDAP like)!
       CaDebug 0, "SITENAME      : " & oSystemInfo.SiteName
       CaDebug 0, "DomainDNSName : " & oSystemInfo.DomainDNSName

       ;--- Return the full domain name -----------------------------------------
       CaDebug 2, "Setting the property ""<$DOMAIN_PROPERTY>"" (lower case)"
       Session.Property("<$DOMAIN_PROPERTY>") = lcase(oSystemInfo.DomainDNSName)
       set oSystemInfo = Nothing
   <$/VbsCaEntry>
#)
<$/VbsCa>
#(
    <$VbsCaSetup
            Binary="<$DOMAIN_PROPERTY.VBS>"
             Entry="SetProperty"
               Seq="AppSearch-"
          SeqTable="InstallUISequence InstallExecuteSequence"
              TYPE="immediate FirstSequence"
               Key="<$DOMAIN_PROPERTY.VBS>"
    >
#)
There are other interesting properties of the "AdSystemInfo" not shown in this example. Note that I didn't look at "UserDomain" or other environment variables as they may not exist for normal users let alone the local system account.

The following shows how the propery could be used to decide if the install should continue:

;--- Now abort if not in the expected domain --------------------------------
#define MUST_BE_IN_DOMAIN_STARTING_WITH  production.
#(
    <$AbortIf
         Condition=^not (<$DOMAIN_PROPERTY> << "<$MUST_BE_IN_DOMAIN_STARTING_WITH>")^
           Message=^This computer is in the domain "[<$DOMAIN_PROPERTY>]"!
                    It should be in a domain starting with "<$MUST_BE_IN_DOMAIN_STARTING_WITH>".^
               Seq="<$DOMAIN_PROPERTY.VBS>-"
          SeqTable="InstallUISequence InstallExecuteSequence"
    >
#)


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Plug and Play Drivers[Next]: Hiding Sensitive Information


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday February 28 2016 at 3:45pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.