1

I would like to schedule the execution of a PowerShell script, with the following criteria:

  • Run the PowerShell script in a visible PowerShell terminal window (I want the PowerShell terminal to popup on-screen so the user can see that the script is executed)
  • Run the PowerShell script on schedule (at some time)
  • Run the script as admin
  • Run the script even if no-one is logged in to the computer

Ideally I'd schedule the task from command line, but that's not really a requirement.

How can I manage this?

2
  • Is the admin account the same user who should see the terminal?
    – Cpt.Whale
    Feb 26, 2021 at 14:43
  • Yes. (ignore this text I just have to write something so the comment is not too long)
    – birgersp
    Feb 27, 2021 at 8:23

1 Answer 1

1

Crate scheduled task:

enter image description here

  • Chose admin account for task execution.
  • Select option Run whether user is logged on or not

Configure time schedule:

enter image description here

Create action:

enter image description here

  • Enter PowerShell in Program/scrip field
  • In Add arguments field enter -File argument with path to script and -ExecutionPolicy argument with bypass value. (-ExecutionPolicy bypass)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .