locked
Task Scheduler Hidden powershell with no popup RRS feed

  • Question

  • Does anyone knows how to make the Task Scheduler to start to run ps1 script as Hidden without Poping up the window for a second (so to say - background task)...

    Currently I am using as arguments:

    -nologo -windowstyle Hidden -file FileLocation

    But even if the script runs in background - it still at the beginnings pops up for a second - before hides it-self...

    I just want to log into the log file the result of: netstat -f -b

    EDIT:

    I found a solution (maybe though not the best one): I set up to run that script as SYSTEM - but to make it more secured in this case - I set the script to be editable only by Administrator... Even System can't edit it without Admin rights...


    • Edited by JanisRogacs Wednesday, May 3, 2017 8:02 PM capital P in Poping
    Wednesday, May 3, 2017 7:16 PM

All replies

  • Any screen output will cause the Window to become visible. 

    You also need to be sure your task is defined correctly.

    By the way...."Poping" is usually spelled with a capital "P";)


    \_(ツ)_/

    Wednesday, May 3, 2017 7:47 PM
  • Any screen output will cause the Window to become visible. 

    You also need to be sure your task is defined correctly.

    By the way...."Poping" is usually spelled with a capital "P";)


    \_(ツ)_/

    1) My script has no visual output.. It only saves the data in the file.

    2) Could you please Define "defined correctly"?


    Wednesday, May 3, 2017 7:52 PM
  • If the task is set to run as the logged in user it will always show a flash when started.


    \_(ツ)_/

    Wednesday, May 3, 2017 8:16 PM
  • I found this solution a while back by calling the PowerShell Script via a .VBS script. Not ideal but, it negates the window flash:
    command = "powershell.exe -nologo -command C:\Scripts\YourScript.ps1"
     set shell = CreateObject("WScript.Shell")
     shell.Run command,0
    Schedule this .VBS in the task scheduler and it will call your script the same as before.

    • Edited by Average-Bear Wednesday, May 3, 2017 9:50 PM
    • Proposed as answer by Average-Bear Wednesday, May 3, 2017 10:05 PM
    Wednesday, May 3, 2017 9:49 PM
  • Advantage/Disadvantage against running restricted file as System?
    Thursday, May 4, 2017 10:07 AM
  • Advantage/Disadvantage against running restricted file as System?

    What does that mean?


    \_(ツ)_/

    Thursday, May 4, 2017 8:02 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Andy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Saturday, May 27, 2017 7:44 AM
  • In windows 10 ,Right click on particular powershell script  task->properties->General and then check "Hidden"  textbox. select windows 10 from the dropdown.
    Thursday, March 8, 2018 6:25 AM
  • In windows 10 ,Right click on particular powershell script  task->properties->General and then check "Hidden"  textbox. select windows 10 from the dropdown.
    That's not what the 'Hidden' checkbox does - it marks it as hidden so if in the view setting sof Task Scheduler you've got hidden items turned off, you don't see the task. Not sure why it exists :)
    Tuesday, March 27, 2018 5:51 AM
  • Maybe this helps:

    https://www.howtogeek.com/tips/how-to-run-a-scheduled-task-without-a-command-window-appearing/

    In short: set the task to "Run whether user is logged on or not" in the task "General" tab

    Thursday, February 14, 2019 2:09 PM
  • Thanks, that did the trick for my powershell script. No popups.

    Tuesday, October 22, 2019 9:27 PM