locked
Powershell script running as Scheduled task problem! RRS feed

  • Question

  • Hi all,

    I created a powershell script to use 7z to make backups.

    The script works fine executing manually, when i execute as a Scheduled Task the process keeps running indefinitely.

    I tried to troubleshoot running the 7z comand standalone as a scheduled task and it works fine.

    I start the 7z command in the powershell like this:

    Start-Process -FilePath <path> -ArgumentList  "<arguments>" -wait  

    anyone have any idea on what is happenning or how can i debug even further the issue?

    Thanks for the help.

    Tuesday, June 26, 2018 9:38 AM

All replies

  • Hi all,

    I created a powershell script to use 7z to make backups.

    The script works fine executing manually, when i execute as a Scheduled Task the process keeps running indefinitely.

    I tried to troubleshoot running the 7z comand standalone as a scheduled task and it works fine.

    I start the 7z command in the powershell like this:

    Start-Process -FilePath <path> -ArgumentList  "<arguments>" -wait  

    anyone have any idea on what is happenning or how can i debug even further the issue?

    Thanks for the help.

    Hi again,

    I solved the problem.

    In the task scheduler i changed the program/script from powershell.exe to C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

    In the arguments i changed from:  -command <script to run > to -NoProfile  -file <script to run>

    Sincerely,

    AM

    Tuesday, June 26, 2018 3:31 PM