If..Then..Else..EndIf
Top  Previous  Next


If expression is true, then the commands (rows) between Then and EndIf are executed.

·Valid relational operators: "=" (equals), "<>" (not equals), "<" (less-than) and ">" (greater-than)  
·Text comparisons are not case sensitive  
·If statements can be nested  
·When comparing text, surround the text with quotes ("text") if the text to compare contains any of the operators  

Category
General

Script section
All

If..Then..Else..EndIf

Examples
If column 2 contains text "New" then create account:

If %col2%=New Then
 Account.Create %username%
EndIf


If object is in container ou=x3/ou=y4 then change / set login script:
(Notice the quotes in the if statement - container path contains the operator "=" .)

Set ContainerPath=ADValue (UserPrincipalName,%col1%@d2.acme.com,ADpathContainer)   
If "%ContainerPath%"="dc=com/dc=acme/dc=d2/ou=x3/ou=y4" Then   
 AD.Account.SetProperty dc=com/dc=acme/dc=d2/ou=x3/ou=y4/cn=%col1%, LoginScript, Script.bat
EndIf