Ytria logo TUTORIALS

This website require JavaScript for full functionality. Please enable JavaScript in your Web browser.


Before you begin:

If you want to learn more about how Ytria's automation scripts function, see our automation basics help page.

For single databases:

Step 1 Copy/paste the script below into any text editor, change your values as needed (in this case, the types of profile documents to look for), and save your file in XML format.
Step 2 Open scanEZ and select the 'Database > Load Automation File' option.
Step 3 Find and select the XML file you just saved, and then click 'Open.'

For multiple databases:

Step 1 Copy/paste the script below into any text editor, change your values as needed, and save your file in XML format.
Step 2 Open databaseEZ and load your server.
Step 3 Select the databases you want to scan for profiles documents, right-click and select the option 'Execute Automation File on...' from the context menu, choose scanEZ from the list, select the servers you want to analyze, and then click 'OK'.
Step 4 Finally, find and select the XML file you just saved, and then click 'Open.'

Here is the script:

<ytriaAutomation Application="scanEZ" ApplicationVersion="16.5">
<!--This will set the script's behavior when encountering an error. In this case,
it will continue.-->
<onerror continue="true" />
<!--This will allow the script to run if called from databaseEZ by using the option
'Execute Automation File On...'-->
<if target="var" test="{%ListSize%}" mode="NotEquals" Value="">
<!--The script uses Loop and List actions. The Loop itself can be modified to fit your
<!--TO SET: these variables define the profile you are looking for. You may change the
values to suit your needs and even add in more lines to the list keeping the format
Note: Personal profile documents are arranged in a level further down in scanEZ's
selection tree and must be selected in a different way.-->
<List name="allProfileName" Action="SetVar" vProfileName="CalendarProfile"/>
<List name="allProfileName" Action="SetVar" vProfileName="NotExistProfile"/>
<List name="allProfileName" Action="SetVar" vProfileName="ColorProfile"/>
<!--This line will expand the Profile Documents section of the selection tree.-->
<Expand target="tree" Category="Profile Documents"/>
<!--Beginning here, the rest of the script is the Loop setup.
All actions within this Loop section will be carried out in turn on all the lines in
the List section (above) that use the specified name. The Loop is set to call on
the List name "allProfileName".-->
<Loop list="allProfileName" OnError="Next">
<!--This next action is mandatory in order for the action within the List lines
referenced to be carried out. In the case of the lines in the List
"allProfileName", the SetVar action is to be executed.-->
<!--Then, everything in the tree will be deselected.-->
<UnSelect Target="tree" name="All"/>
<!--This will place the focus on the Profile Documents category so that the
SelectByRegex action can be used on the first-level entries within.-->
<Focus Target="Tree" Category="Profile Documents"/>
<!--The following line will enact a regex search on the first-level profile documents
to find any profile documents that contain the name provided.-->
<SelectByRegex Regex="{%vProfileName%}"/>
<!--As stated early on in this script, Personal Profile documents are arranged at a
deeper level in the selection tree. If you want to be able to search through both
of these levels at the same time to find both the first level profile documents
and personal profile documents with this name use this line in place of the regex
search above <Select Target="Tree" Category="Profile Documents"
Type="{%vProfileName%}"/> -->
<!--This will create a new My Selection folder containing the found documents.
By doing this the displayed titles can be set to your desired form (titles
cannot be set within the Profile Documents category).-->
<Setparam Field="MySelectionName" Value="Selection of {%vProfileName%}"/>
<Setparam Field="TitleOptionType" Value="Formula"/>
<Setparam Field="TitleOptionFormula" Value="@Implode(@DbName;&quot;!!&quot;)"/>
<!--Then the focus is placed on the newly created My Selection folder.-->
<Focus Target="Tree" Category="Selection of {%vProfileName%}"/>
<!--The following If condition declares that if the My Selection does exist,
(meaning that something has been found) the nested child actions will be
<if Target="Tree" Test="FocusRoot" Mode="NotEquals" Value="True">
<!--A Values function is carried out on the focused My Selection folder.-->
<!--All items within the Values grid are selected.-->
<SetParam Target="SelectDocumentItems" Field="All" value="true"/>
<!--And finally all the findings are exported to an Excel file; the results
for each profile name will be placed on its own sheet within the file.
The file will be saved in the same location as the this Automation file.-->
<SetParam field="FilePath" value="{%CurFilePath%}report_FindProfile.xlsx"/>
<SetParam field="SelectedRowsOnly" value="false"/>
<SetParam field="ExportType" value="Excel"/>
<SetParam field="Mode" value="AppendRows"/>
<SetParam field="ExcelSheetName" value="{%vProfileName%}"/>
<SetParam field="OpenFileOnceGenerated" value="False"/>