Kaseya Community

Problem using Database View vMachine.OsType variable in script IF condition

  • Okay, call me stupid, but I can't seem to figure this one out...

    I am trying to develop a script to Disable UAC. I have the registry keys to change (from another thread regarding JKDEFRAG). But I am trying to make a more generic/general master script that I can call from many places. I am stuck on the very first test in the very first script.

    BACKGROUND: I am trying to write the script so that I can call it from many different scripts. My first check is to see if the system is running Vista. I know that I could put a script condition when calling the script (ie. instead of Perform step X on All Operatign Systems, just choose Windows Vista from the DropDown Box, but I am trying to plan ahead for the future. For example, I may need to call the scan Disable UAC script with running on a Windows 2008 box, or when running Windows 2012 or whatever they release in the future. So I gigure make a generic script that gets called, then have that script check conditions. In the future, I just change by Disable UAC script to also run for 2008, 2012, etc - and no need to edit all of my other scripts.

    Sounded simple to me. But I am stuck on the very first IF condition. I am using the vMachine.OsType Database View variable on my IF confition. But my script runs ELSE no matter what - if the system is running XP, Vista, etc.

    In the script, I write the contents of vMachine.OsType Database View variable to the Script Log, which if you run it on a Vista machine, it records that vMachine.OsType=Vista.

    I must be doing something wrong, but I can not figure it out.

    Thanks in advance for the help.

    Script Name: Disable UAC 1
    Script Description: Checks to see if the Operating System is Vista.

    IF Check Variable
    Parameter 1 : #vMachine.OsType#
    Contains : Vista
    Write Script Log Entry
    Parameter 1 : vMachine.OsType = #vMachine.OsType#. Need to confirm/set UAC to Disabled.
    OS Type : 0
    Write Script Log Entry
    Parameter 1 : vMachine.OsType = #vMachine.OsType#. No need to worry about UAC.
    OS Type : 0


    Legacy Forum Name: Problem using Database View vMachine.OsType variable in script IF condition,
    Legacy Posted By Username: lwolf
  • Take the single space out before the word Vista in the Contains statement, i.e. instead of:

    Contains : Vista

    set it to

    Contains :Vista

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: pcmnetmanage