Windows 10: How do I avoid PShell window when I run a ps1 script w/Task Scheduler?

Discus and support How do I avoid PShell window when I run a ps1 script w/Task Scheduler? in Windows 10 Software and Apps to solve the problem; Ive created a script intended to support a backup cycle by playing a sound and displaying a window with relevant info which is executed via Task... Discussion in 'Windows 10 Software and Apps' started by ritjesman, Nov 15, 2020.

  1. ritjesman Win User

    How do I avoid PShell window when I run a ps1 script w/Task Scheduler?


    Ive created a script intended to support a backup cycle by playing a sound and displaying a window with relevant info which is executed via Task Scheduler. When I test run the script I either get
    1. the alert window/sound plus the PowerShell window when "Run only when user is logged on" is selected, or
    2. only sound and no alert/PowerShell windows if "Run whether user is logged on or not" is selected

    The desired state is having the alert window displayed but not the PowerShell window. Ive tried using the run Hidden option but that didnt do the trick.

    How do I get the alert window without the PowerShell window?

    Thanx in advance for your time & expertise.

    :)
     
    ritjesman, Nov 15, 2020
    #1
  2. Peer_Sam Win User

    Task Scheduler doesn't run script

    Hi,

    Thank you for writing to Microsoft Community Forums.

    Are you able to run the script manually? If yes, does it do what it is intended to?

    Disable the UAC temporarily.

    Make sure that the Task scheduler
    service is running.

    Press ‘Win+R’.

    Type Services.msc.

    Locate the service Task scheduler
    and make sure that it is in running state.

    Go to the Conditions
    tab in task scheduler and make sure that no such condition is set which could block the task from running.

    Enable All Tasks History in Task scheduler and run the scheduled task.

    Refresh the task scheduler and check if you find any error message/code for any step in the task run.

    Also try with disabling Run whether the user is logged on or not
    option and see if the script runs.

    Hope it helps.

    Peer Samie

    Microsoft Community-Moderator
     
    Peer_Sam, Nov 15, 2020
    #2
  3. Window's Task Scheduler Not Running

    Hi,

    To assist you better, kindly provide us more details by answering the following questions:

    • Have you tried recreating the task? If so, are you getting the same issue?
    • Have you tried creating a new task?
    Meanwhile, we suggest that you ensure that the Task Scheduler is running. You can verify if the service is running by following these steps:

    • Press Windows key + R on your keyboard.
    • Type services.msc and hit Enter.
    • Under Services (Local), make sure that the Task Scheduler service's status is
      Started or Enabled.
    Should you need further assistance, feel free to get back to us.
     
    Monica Cam, Nov 15, 2020
    #3
  4. S-278 Win User

    How do I avoid PShell window when I run a ps1 script w/Task Scheduler?

    Task Scheduler doesn't run script

    Hey Microsoft Community,

    I'm trying to create a task in Task Scheduler that runs a specific script. The issue is that when the task runs (whether I do it manually or if it's scheduled), the script doesn't actually get executed. I know that the script works, and I have tried using
    both .EXE and .BAT scripts. I have set the task to run whether I'm logged in or not, using Highest Privileges, from my Administrator account; I have Full Access to the script file and the directory it's in; I have tried putting the directory it's in into the
    "Start in" field; I have tried opening Task Scheduler as an Administrator. Every time the task runs successfully, but the thing my script is supposed to do isn't done, from which I am inferring that the script doesn't get executed. The script isn't using any
    network connections. It's also not being blocked by my antivirus, I checked by temporarily turning it off.

    System info:

    Windows 10 x64 version 1803

    Thanks in advance!
     
    S-278, Nov 15, 2020
    #4
Thema:

How do I avoid PShell window when I run a ps1 script w/Task Scheduler?

Loading...
  1. How do I avoid PShell window when I run a ps1 script w/Task Scheduler? - Similar Threads - avoid PShell window

  2. 2147942667. on task scheduler when running python script

    in Windows 10 Gaming
    2147942667. on task scheduler when running python script: I am trying to run the Python script on the task scheduler but it gives the error 2147942667which means an invalid path. but that is correctone more thing I came around to was the permission that the user doesn't have permission to access the file but I have a single user...
  3. 2147942667. on task scheduler when running python script

    in Windows 10 Software and Apps
    2147942667. on task scheduler when running python script: I am trying to run the Python script on the task scheduler but it gives the error 2147942667which means an invalid path. but that is correctone more thing I came around to was the permission that the user doesn't have permission to access the file but I have a single user...
  4. Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler

    in Windows 10 Network and Sharing
    Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler: Hi there, I have created a .ps1 file which contains a RoboCopy script to copy files from a folder on my C: drive which contains a database, and paste them into a folder on my OneDrive so that they can be safely backed up to the cloud and have a history of changes.The code...
  5. Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler

    in Windows 10 Gaming
    Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler: Hi there, I have created a .ps1 file which contains a RoboCopy script to copy files from a folder on my C: drive which contains a database, and paste them into a folder on my OneDrive so that they can be safely backed up to the cloud and have a history of changes.The code...
  6. Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler

    in Windows 10 Software and Apps
    Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler: Hi there, I have created a .ps1 file which contains a RoboCopy script to copy files from a folder on my C: drive which contains a database, and paste them into a folder on my OneDrive so that they can be safely backed up to the cloud and have a history of changes.The code...
  7. Problems running a ps1 script

    in Windows 10 Gaming
    Problems running a ps1 script: I have been trying to run the script below but keep getting error messages shown in attached screenshots which I assume is to do with access. The script ran perfectly before I did a Window 11 reinstall recently. Any help in laymans terms on how to resolve would be greatly...
  8. Problems running a ps1 script

    in Windows 10 Software and Apps
    Problems running a ps1 script: I have been trying to run the script below but keep getting error messages shown in attached screenshots which I assume is to do with access. The script ran perfectly before I did a Window 11 reinstall recently. Any help in laymans terms on how to resolve would be greatly...
  9. Running a script on file deletion with task scheduler.

    in Windows 10 Ask Insider
    Running a script on file deletion with task scheduler.: I'm trying to figure out how to run a (python) script whenever any file is deleted with task scheduler. I tried googling but with no success, all I found out was that the event ID for file deletion is 4660 I think, and it's probably under security logs. The problem is that...
  10. Task Scheduler doesn't run script

    in Windows 10 Software and Apps
    Task Scheduler doesn't run script: Hey Microsoft Community, I'm trying to create a task in Task Scheduler that runs a specific script. The issue is that when the task runs (whether I do it manually or if it's scheduled), the script doesn't actually get executed. I know that the script works, and I have tried...