How to use Orchestrator 2012 to monitor a folder for multiple file extensions

GrayAndYellowGears Imagine a scenario where you need to monitor a folder for specific file extensions so that when all of the file extensions you are expecting are present, the next action in Orchestrator will be kicked off. Opalis had the capability to perform this as it performed an ‘AND’ for ‘Folder Monitor’, but in Orchestrator this has been changed to an ‘OR’ operation. So how can we do this today?

Simple: Place a ‘Monitor File’ in a Runbook and under ‘Details’ enter the path to watch and a file extension of ‘*.*’. Then under ‘Triggers’ place a check in ‘Created’. To the right of ‘Monitor File’ place a ‘Run .Net Script’ activity. Under ‘Details’ choose ‘PowerShell’ as the type, then enter the following script. In this example we are monitoring the ‘C:\Temp’ directory. ‘$test’ in the script is the case sensitive variable name you will use in the next step.

set-location -path c:\temp
$test = (Test-Path *.fund) -and
(Test-Path *.rating) -and
(Test-Path *.position) -and
(Test-Path *.issuer) -and
(Test-Path *.security) -and
(Test-Path *.model_clsf_scheme)

Under ‘Published Data’ click ‘Add’. Under ‘Name’ create a variable name to capture output. Under ‘Variable Name’ enter a variable that will be used; do not place a $ in front of the variable name; the variable name is case sensitive.

To see the results of the script choose the ‘Details’ tab. Under ‘Summary’ or ‘Details’ right click and choose to subscribe to ‘Published Data’. A ‘Published Data’ window will pop up. Choose the variable name you created previously here. Results of the run will show up under ‘Events’ in Orchestrator Designer.

Jonathan Jordan | Senior Support Escalation Engineer | Management and Security Division

Get the latest System Center news on Facebook and Twitter:

clip_image001 clip_image002

App-V Team blog:
ConfigMgr Support Team blog:
DPM Team blog:
MED-V Team blog:
Orchestrator Support Team blog:
Operations Manager Team blog:
SCVMM Team blog:
Server App-V Team blog:
Service Manager Team blog:
System Center Essentials Team blog:
WSUS Support Team blog:

The Forefront Server Protection blog:
The Forefront Endpoint Security blog :
The Forefront Identity Manager blog :
The Forefront TMG blog:
The Forefront UAG blog: