I have the below PowerShell script called via a SSIS Process Task to check if a file is locked - how do I modify so it checks if the file exists first.
- If it does not exist, then exit with 999 
- If it does exist but is locked, then exit with 999 
- If it does exist and is not locked, then exit with 0 - $file = "\\xxxxxx\xxxx\xxxxx\xxxxxxxxx\task_status.log" try { [IO.File]::OpenWrite($file).close();exit 0 } catch { exit 999}
 
    