REQUIREMENTS
Create a deployment job that first detects whether the targeted Windows machine is 32 or 64 bit then initiates the appropriate installer.
OBSTACLES
Unlike DS 6.9, there are no built in conditions on client jobs in 7.x, instead the return code from a previously run task is evaluated in the conditional statement(s). This allows you to create a client task with a script that returns a code based on a decision (e.g. is this machine 32 bit or 64 bit). In the client job, you can base your deployment logic on the return code. The issue is, I don’t see an easy way to add non-zero success codes on a client job (as was offered in DS 6.9). What is provided is an option to allow the job to continue regardless of failures. Ignoring failures is not an option for us. I want our support team to see these failures and act accordingly. To better illustrate this, please see example below:
Conditional Deployment Job with “Fail job if any task fails” option DISABLED (allowed to fail)
- Run “Script to determine OS bit” (returns 64 for 64 bit OS)
- IF “Script to determine OS bit” = 64 (returns 0 for TRUE)
- RUN “64 bit installer” (returns 3 - file not found)
- ELSE
- RUN “32 bit installer” (returns false as it should)
In the above example we were able to determine that the targeted machine was 64-bit, but there was an error during the install and the task returned an error code. Because the “Fail job if any task fails” option was disabled to allow non-zero return codes, we rely on our front-line staff to check back with all tasks within a job to verify success. I opt for more reliable automation.
SOLUTION
The question is, where in the 7.x environment can we add success codes? Software Catalogue. Basically, what I did was I added a custom executable (script, MSI, EXE) into the Software Catalogue designed to return a code based on the OS Bit. I add those custom return codes as Software Release success codes. I create a client task that calls this Software Release and call on that task in all deployment jobs where a 32/64 bit decision is made.
Create executable
*** I’m sure you can simply use a script without compiling into an .EXE as I have, but I’ll just go through my approach. My executable is basically a VBS script compiled as an .EXE. I compiled my VBS using PrimalScript. There may be free VBS Compilers out there.
- Create a script to determine whether or not the target Windows machine is 32/64 bit. I’ll add a simple script under the Reference section (at the end of this document).
- Using a script compiler utility, compile the script to an .EXE (optional).
Software Catalogue
- Open the Symantec Management Console (SMP)
- Navigate to Manage > Software Catalogue
- Click on Import
- From the Import Software window under Package Contents, click Add
- Navigate to the file you create in the previous section and click the Open button
- If the filename is not bold, click Set Installation File
- Software Type should be Software Release
- Click Next
- When prompted agree to edit the Software Release after saving
- From the Software Release window, click on the Package tab
- Under the Command Lines section, click Add Command
- Enable “Command Line requires a package” and select your package from the drop-down list
- From the Add or Edit Command Line window
- Name: give your command a meaningful name (e.g. Get OS Bit)
- Installation file type: if you’ve chosen to go with a script (e.g. VBS), select other. In my case, I’ve chosen EXE
- Command type: custom
- Set as default command for this command type: Yes
- Command Line:
- If you’ve chosen to go with a script, you’ll have to add a command that would launch the script (e.g. “cscript file.vbs”)
- in my case the command is simply “file.exe”
- Success codes: enter all success codes here. In my case it’s “10064” for 64-bit and 10032 for 32-bit
- Click OK on each window to save your Software Release
Create Quick Software Delivery Task
- From SMP, navigate to Jobs/Tasks
- Create a new task by right-clicking on the destination container and click on Select > Task
- From the Create New Task window, select Quick Delivery
- Give it a meaningful name
- From the drop-down text box for Software, select the software release you created in the previous section
- Verify the correct Command Line and Package values are set
- Click OK
Create Deployment Job
- From SMP, navigate to Jobs/Tasks
- Create a new job by right-clicking on the destination container and click on Select > Client Job
- From the Job section (right), give the job a meaningful name
- Click on Add Existing
- Navigate to the Quick Software Delivery Task you created in the previous section. For the sake of this example, we’ll name this task “OS Bit Check”
- Click OK
- Click New > Condition
- Edit condition so it displays something similar to the following:
- Where: [ OS Bit Check - Return Value ] [ Equals ] [ 10064 ]
- Click OK
- Click Add Existing and select the 64 bit installer task/job
- Click Add Existing and select the 32 bit installer task/job
- Your deployment job should looks something like the following:
Job Start
Run “OS Bit Check”
If “OS Bit Check” Return Value equals 10064
Run “64 bit installer”
Else
Run “32 bit installer”
Stop - Make sure the checkbox for “Fail if any job fails” is checked
- Click Save Changes
REFERENCE MATERIAL
VBS Script to determine 32/64 bit OS
'************************************************************************************************************************************************
' VARIABLE DEFINITION
'************************************************************************************************************************************************
CONST HKEY_LOCAL_MACHINE = &H80000002
'************************************************************************************************************************************************
' FUNCTIONS
'************************************************************************************************************************************************
function getBitWidth(strComputerName)
set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"& strComputerName & "\root\default:StdRegProv")
strKeyPath = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"
strValueName = "Identifier"
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
if (instr(strValue,"64")) then
getBitWidth = 64
else
getBitWidth = 32
end if
end function
function getOSVersion(strComputerName)
set objWMI = GetObject("winmgmts://"& strComputerName & "/root/cimv2")
set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
for each objItem in colItems
strOSVersion = left(objItem.Version, 3)
next
getOSVersion = strOSVersion
end function
'************************************************************************************************************************************************
' BEGIN
'************************************************************************************************************************************************
strComputerName = "."'local
intBitWidth = getBitWidth(strComputerName)
strOSVersion = getOSVersion(strComputerName)
select case strOSVersion
case "6.1" : strOSName = "Windows 7"
case "6.0" : strOSName = "Windows Vista"
case "5.2" : strOSName = "Windows 2003"
case "5.1" : strOSName = "Windows XP"
case "5.0" : strOSName = "Windows 2000"
case "4.0" : strOSName = "Windows NT 4.0"
case else : strOSName = "Windows 9x"
end select
WScript.Quit("100"& intBitWidth)