0

I am attempting to run the following Powershell script automatically using windows task scheduler 1.0. The script works fine if i run it manually (it asks for the administrator password several times), but even if i trigger the task manually in task scheduler it just gets stuck at "Running" and never seems to actually do anything.

$xtu_path = 'C:\Program Files (x86)\Intel\Intel(R) Extreme Tuning Utility\Client\XTUCli.exe'
$status = get-service -name "XTU3SERVICE" | Select-Object {$_.status} | format-wide
if ($status -ne "Running") { start-service -name "XTU3SERVICE"}
# Long Boost Settings in Watts
& $xtu_path -t -id 48 -v 20
# Short Boost Settings in Watts
& $xtu_path -t -id 47 -v 25
# Boost Time Settings in seconds (max 96)
& $xtu_path -t -id 66 -v 96
# processor current limit 
& $xtu_path -t -id 84 -v 32
stop-process -id $PID -force

I have set Task scheduler to run the task using the administrator user and with the highest permissions. I feel like the issue might be to do with what to put in the "program/script" and "Add arguments (optional)" fields in the edit action popup (see image in link). Task scheduler edit action

I have tried several combinations of entries to these fields but nothing that I've tried has worked. Does anybody know what I should be putting in these fields or how to fix the issue?

Btw I've set .ps1 files to open with powershell by default

  • What command do you use to run it manually? Does it actually get stuck at running or are you assuming it gets stuck. Windows 10 task scheduler status window does not auto update to "Ready" when finished. You have to click on Refresh. Try this command in your scheduled task: powershell and in "add arguments (optional):" -ExecutionPolicy Bypass -Command "& "path-to-your.ps1"" – somebadhat Apr 6 at 11:51
  • So that solution '-ExecutionPolicy Bypass -Command "& ' didn't actually work but you did get me thinking. So I changed the execution policy for the file directory and got task scheduler to run powershell and add the .ps1 script as an argument and it now works! so thankyou! – Ziggy Smith Apr 7 at 2:30
  • Would you like to add an answer? Please take our short tour to learn how the site is supposed to work. – Kamil Maciorowski Apr 7 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.