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" > #)