MFT Server Events Powershell process gets left behind


I have Windows Server with Serv-U MFT and have configured several MFT Domains each configured with a Domain MFT Event that triggers on file download

The Event fires Executable:Powershell.exe and the Command Line parameter calls a script that effectively Copys the file that's downloaded then places the copy in a separate directory for Archiving

Like So

The Issue Im facing is that Periodically my Users inform me that the File move process is not working and when I investigate I find numerous Powershell.exe process running under the Serv-u Process acct

At this stage Im killing the left over Powershell Processes manually

I would like to either have a line in my code to ensure powershell closes or perhaps have a sepearte process to Kill rogue powershell process every day

Has anyone seen this issue before and if so How did you manage this situation/ left over processes?

Im currently looking at experimenting with "Stop-Process -Id $PID" comd in the script but its not having a great effect


  • Issue is resolved

    Found an answer to my left over powershell process after Logging a case with MS

    Long story short, My Powershell script had a line to clean up files after the File move like so

    ## Remove any *.old File left over after download

    Get-childItem $FilesMoved -Recurse | Remove-Item -Include *.old -Force

    If the Source path contained subfolders or subfiles then the process got stuck in background waiting on response, which the user never sees

    Updated script as follows, replace '-force' with '-Recurse' thus prevent powershell wait

    Get-childItem $FilesMoved -Recurse | Remove-Item -Include *.old -Recurse