Kaseya Community

IF Statement for Domain/Workgroup

This question is not answered

Hey,

I'm relatively new to the Kaseya procedure creating party, and I'm having troubles creating a script to do X when on a domain otherwise do Y.

This is my feeble attempt so far:

If true

getVariable("Constant Value", "#vAgentConfiguration.workgroupDomainName#", "domainname", "All Windows Operating Systems", "Halt on Fail")

If checkVar("#domainname#") Contains "(domain)"

executeShellCommand... etc

Else

executeShellCommand... etc

Unfortunately it isn't working and I'm struggling to find out the correct way to do this, can someone point out what I'm doing wrong please?

Thanks :)

All Replies
  • If you are just wanting to do something when on a domain, and something when not.. what I would suggest doing actually is.

    IF #vAgentConfiguration.workgroupDomainType# is less than 3

      workgroup steps

    ELSE

     domain steps

    or you can reverse it to

    IF #vAgentConfiguration.workgroupDomainType# is greater than 2

      domain steps

    ELSE

     workgroup steps

    then you do not even need to get the domain name if you don't need it.

  • Thanks for the reply.

    Are you able to specify exactly which statements I should be using to do what you suggested?

    eg.

    IF checkVar
    or
    IF true > getVariable



    typo
    [edited by: dmurton at 4:24 PM (GMT -8) on Dec 2, 2014]
  • Thanks for the reply,

    Can you advise on the specific statements I need to be using please?

  • <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

    <Procedure name="test" treePres="3" id="83656899" folderId="41412522861476692183826331" treeFullPath="myProcedures - jputman">

    <Body description="">

    <If description="">

    <Condition name="True"/>

    <Then>

    <If description="">

    <Condition name="CheckVariable">

    <Parameter xsi:type="StringParameter" name="VariableName" value="#vAgentConfiguration.workgroupDomainType#"/>

    <Parameter xsi:type="EnumParameter" name="Condition" value="LessThan"/>

    <Parameter xsi:type="StringParameter" name="Value" value="3"/>

    </Condition>

    <Then>

    <Statement name="WriteScriptLogEntry" continueOnFail="false">

    <Parameter xsi:type="StringParameter" name="Comment" value="This is a workgroup computer"/>

    </Statement>

    </Then>

    <Else>

    <Statement name="WriteScriptLogEntry" continueOnFail="false">

    <Parameter xsi:type="StringParameter" name="Comment" value="This is a domain computer"/>

    </Statement>

    </Else>

    </If>

    </Then>

    </If>

    </Body>

    </Procedure>

    </ScriptExport>