SOLVED

Create a task scheduler that triggers a task if a csv file is created

%3CLINGO-SUB%20id%3D%22lingo-sub-2597170%22%20slang%3D%22en-US%22%3ECreate%20a%20task%20scheduler%20that%20triggers%20a%20task%20if%20a%20csv%20file%20is%20created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2597170%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3EMany%20thanks%20in%20advance%2C%20I%20have%20a%20powershell%20script%20that%20runs%20based%20on%20an%20input%20csv%20file.%20I%20have%20to%20run%20the%20script%20once%20a%20csv%20file%20is%20created%2C%20kindly%20help%20me%20by%20letting%20me%20know%20hos%20to%20trigger%20a%20task%20based%20on%20csv%20file%20creation.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2597170%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Etask%20scheduler%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETriggers%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2597517%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20task%20scheduler%20that%20triggers%20a%20task%20if%20a%20csv%20file%20is%20created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2597517%22%20slang%3D%22en-US%22%3EHi%20CLCCW%2C%3CBR%20%2F%3EThanks%20for%20the%20suggestion%2C%20I%20thought%20about%20this%20idea%20initially%2C%20but%2C%20was%20worried%20about%20the%20after%20effects%2C%20like%20what%20about%20the%20load%20on%20the%20server%20of%20these%20repeated%20tasks%3F%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2597174%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20task%20scheduler%20that%20triggers%20a%20task%20if%20a%20csv%20file%20is%20created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2597174%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248061%22%20target%3D%22_blank%22%3E%40PoorMens_Bravo%3C%2FA%3E%26nbsp%3BPersonally%2C%20I%20would%20add%20to%20the%20PowerShell%20code%20a%20check%20for%20the%20existence%20of%20the%20CSV%20file(s)%20and%20progress%20only%20if%20it%20exists%2C%20otherwise%20quit.%20You%20would%20then%20also%20need%20to%20set%20the%20task%20to%20run%20more%20frequently.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eif%20(Test-Path%20-Path%20C%3A%5CSomeFileName.csv%20-PathType%20Leaf)%7B%22found%2C%20do%20something%22%7DElse%7B%22quit%22%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EApologies%20if%20I%20misunderstood%20requirements.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi All,

Many thanks in advance, I have a powershell script that runs based on an input csv file. I have to run the script once a csv file is created, kindly help me by letting me know hos to trigger a task based on csv file creation.

2 Replies
best response confirmed by PoorMens_Bravo (Occasional Contributor)
Solution

@PoorMens_Bravo Personally, I would add to the PowerShell code a check for the existence of the CSV file(s) and progress only if it exists, otherwise quit. You would then also need to set the task to run more frequently. 

 

if (Test-Path -Path C:\SomeFileName.csv -PathType Leaf){"found, do something"}Else{"quit"}

 

Apologies if I misunderstood requirements. 

Hi CLCCW,
Thanks for the suggestion, I thought about this idea initially, but, was worried about the after effects, like what about the load on the server of these repeated tasks??