Deployment Solution

 View Only
  • 1.  Altiris 7.1 OS Bit Check - Custom Token Variable

    Posted Oct 24, 2011 10:41 AM

    One of the functions of 6.9 that I definately miss in 7.1 is the ability to use conditions based on the clients to perform specific install actions. The most common purpose was to make a 32/64 application deployment job that would choose between the two. Here are the steps I am using to recreate this feature.

    Create a custom token variable for OS bit

    1. Open Settings -> Deployment -> Tokens from your deployment console
    2. Click New Token to create a new token. 
    3. On the right type the name OSBIT
    4. Copy and paste this SQL statement into the SQL Statement field: select [System Type] from [dbo].[Inv_AeX_AC_Identification] where [_ResourceGuid] = '%COMPUTERID%' 
    5. Validate the SQL (Button) and click Save Changes.

     

    Create a task to perform the check and return the OS bit

    1. In the Jobs/Tasks pane right click on your tasks folder and select new - task
    2. Set the script type to VBScript. 
    3. Paste this as the script:

     

    if "%OSBIT%" = "Win32" then
       wscript.quit(32)
    elseif "%OSBIT%" = "Win64" then
       wscript.quit(64)
    else
       wscript.quit(0)
    End If
    1. Click save changes to save the script

     

    Add this task to the beginning of your job and execute installs specific to the architecture

    1. In the Jobs/Tasks pane right click on your jobs folder and select new - client job
    2. Click Add Existing and point to the Check OS Bit Task
    3. Highlight the Check OS Bit Task and click New ->Condition
    4. In the Where: Field select Check OS Bit - Return Value
    5. In the input field to the right of "Equals" type 32
    6. Highlight the created If "Check OS Bit" Return Value equals 32 and click the Add Existing Button
    7. Select your 32 bit installation task
    8. Select the else condition and click new->Condition
    9. In the Where: field select Check OS Bit - Return Value
    10. In the input field to the right of "Equals" type 64
    11. Highlight the created if "Check OS BIT Return Value equals 64 and click the Add Existing button
    12. Select your 64 bit installation task.


  • 2.  RE: Altiris 7.1 OS Bit Check - Custom Token Variable

    Posted Oct 24, 2011 03:34 PM

    Not much of a DS user, but if you are deploying a package couldn't you use an applicability rule for the software? The software resource should be able to determine if the software can be installed or not installed depending on the architecture. 



  • 3.  RE: Altiris 7.1 OS Bit Check - Custom Token Variable

    Posted Oct 25, 2011 09:53 AM

    Only if you're deploying the software via policy.  If you're deploying it via a quick delivery or package delivery task, rules aren't processed.



  • 4.  RE: Altiris 7.1 OS Bit Check - Custom Token Variable

    Broadcom Partner
    Posted Oct 25, 2011 12:19 PM

    Hi darkharmonics

    Seems like very similar what i posted 3 month ago with screenhots...

    Take a look at: https://www-secure.symantec.com/connect/forums/job-conditions-cms-71

    Network23



  • 5.  RE: Altiris 7.1 OS Bit Check - Custom Token Variable

    Posted Nov 09, 2011 08:14 AM

    Good stuff darkharmonics.  I had no clue how to use the condition rules until I read this.  I could not get your vbscript to work though so I replaced your OSBIT with the command script below, from network23 link above, and it worked. 

     

    REM Check for System Type / Architure

    IF '%SYSTEMTYPE%' == 'win64' GOTO ERROR64
    IF '%SYSTEMTYPE%' == 'WIN32' GOTO ERROR32

    :ERROR64
    EXIT 64

    :ERROR32
    EXIT 32



  • 6.  RE: Altiris 7.1 OS Bit Check - Custom Token Variable

    Posted Nov 09, 2011 08:54 AM

    You'll get more connect points if you post something like this as an article.



  • 7.  RE: Altiris 7.1 OS Bit Check - Custom Token Variable

    Posted Nov 15, 2011 12:51 PM

    I posted something similar a couple months ago. I'm still not happy with the workaround as it can cause other problems that you would have to script around.

    First create a Run Script Task somewhere you'll know where to find it. Type vbscript, contents of script below.  You can change/add whatever you need for return codes. I've set the basic ones I need to check for (eg. Server 2003/2008/R2, x86/x64, Citrix y/n).

    Add this Run Script as the first task in your job and then add conditions based on your return code just like above and uncheck the Fail job if any Task fails.

    The only bad thing about this is if your package fails to install for one reason or another or one of your tasks fails job will still show success even though the software could possibly not be installed or broken.

     

    EXIT CODES RETURNED
    '
    '(1) 'Server 2003 x86 No Citrix
    '(2) 'Server 2003 x64 No Citrix
    '(3) 'Server 2008 Std x86 No Citrix
    '(4) 'Server 2008 Std x64 No Citrix
    '(5) 'Server 2008 R2 x86 No Citrix
    '(6) 'Server 2008 R2 x64 No Citrix
    '(10) 'Server 2003 x86 with Citrix
    '(11) 'Server 2003 x64 with Citrix
    '(12) 'Server 2008 Std x86 with Citrix
    '(13) 'Server 2008 Std x64 with Citrix
    '(14) 'Server 2008 R2 x86 with Citrix
    '(15) 'Server 2008 R2 x64 with Citrix
    '(20) 'XP 32 bit

    ON ERROR RESUME NEXT
    strComputer = "."

    dim osname, osver, procbit, build, ProdType, majorversion, minorversion, citrix

    Set Wmi = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    Set colItemsOS = Wmi.ExecQuery("SELECT * FROM Win32_OperatingSystem",,48)
    Set colItemsProc = Wmi.ExecQuery("SELECT * FROM Win32_Processor", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)

    For Each objItem in colItemsOS
        osname = objItem.Caption
        osver = objItem.Version
        build = objItem.BuildNumber
        ProdType = objItem.ProductType
    Next

    For Each objItem in colItemsProc
        procbit = objItem.AddressWidth
    Next

    dim lngpos1, lngPos2
    lngPos1 = instr(osver, ".")
    lngPos2 = instr(lngPos1 + 1,osver, ".")
    majorVersion = left(osver, lngpos1 - 1)
    if lngPos2 = 0 then
    minorVersion = mid(osver, lngpos1 + 1)
    else
    minorVersion = mid(osver, lngpos1 + 1, len(osver) - lngpos2 - (lngpos1 + 1))
    end if

    Set tstWMInamespace = GetObject("winmgmts:\\" & strComputer & "\Root\Citrix")
    if ERR <> 0 then
        citrix = 0
    elseif ERR = 0 then
        citrix = 1
    end if

    wscript.echo "Os Name: " & CStr(osname)
    wscript.echo "OS Ver: " & osver
    wscript.echo "Poc Bit: " & procbit
    wscript.echo "Build #: " & build
    wscript.echo "Major: " & majorversion
    wscript.echo "Minor: " & minorversion
    wscript.echo "Product Type: " & ProdType
    wscript.echo "Citrix: " & citrix

    if majorversion="5" and minorversion="2" and procbit = "32" and ProdType = "3" and citrix = "0" then wscript.quit(1) 'Server 2003 x86 No Citrix
    if majorversion="5" and minorversion="2" and procbit = "64" and ProdType = "3" and citrix = "0" then wscript.quit(2) 'Server 2003 x64 No Citrix
    if majorversion="6" and minorversion="0" and procbit = "32" and ProdType = "3" and citrix = "0" then wscript.quit(3) 'Server 2008 Std x86 No Citrix
    if majorversion="6" and minorversion="0" and procbit = "64" and ProdType = "3" and citrix = "0" then wscript.quit(4) 'Server 2008 Std x64 No Citrix
    if majorversion="6" and minorversion="1" and procbit = "32" and ProdType = "3" and citrix = "0" then wscript.quit(5) 'Server 2008 R2 x86 No Citrix
    if majorversion="6" and minorversion="1" and procbit = "64" and ProdType = "3" and citrix = "0" then wscript.quit(6) 'Server 2008 R2 x64 No Citrix

    if majorversion="5" and minorversion="2" and procbit = "32" and ProdType = "3" and citrix = "1" then wscript.quit(10) 'Server 2003 x86 with Citrix
    if majorversion="5" and minorversion="2" and procbit = "64" and ProdType = "3" and citrix = "1" then wscript.quit(11) 'Server 2003 x64 with Citrix
    if majorversion="6" and minorversion="0" and procbit = "32" and ProdType = "3" and citrix = "1" then wscript.quit(12) 'Server 2008 Std x86 with Citrix
    if majorversion="6" and minorversion="0" and procbit = "64" and ProdType = "3" and citrix = "1" then wscript.quit(13) 'Server 2008 Std x64 with Citrix
    if majorversion="6" and minorversion="1" and procbit = "32" and ProdType = "3" and citrix = "1" then wscript.quit(14) 'Server 2008 R2 x86 with Citrix
    if majorversion="6" and minorversion="1" and procbit = "64" and ProdType = "3" and citrix = "1" then wscript.quit(15) 'Server 2008 R2 x64 with Citrix

    if majorversion="5" and minorversion="1" and procbit="32" then wscript.quit(20) 'XP 32 bit

    wscript.quit(999)



  • 8.  RE: Altiris 7.1 OS Bit Check - Custom Token Variable

    Posted Nov 21, 2011 01:54 PM

    I had seen something similar but nothign exactly like how I described above. I wanted to post this to hopefully help others who are trying to figure it out.



  • 9.  RE: Altiris 7.1 OS Bit Check - Custom Token Variable

    Posted Nov 21, 2011 01:55 PM

    Thanks. I'm just looking to help others really :)