简体   繁体   中英

Read the contents of a hidden powershell script running trough Task Scheduler

So I have a bunch of powershell scripts that I run through Task Scheduler. Depending on their tasks and the time it takes for them to run, some run every minute, others every hour and others every day and others weekly.

I run all of these scripts through Task Scheduler using the following configurations: General: ✔ Run wether user is logged on or not ✔ Run with the highest privileges ✔ Hidden

Actions: "C:\Program Files\PowerShell\7\pwsh.exe" -nologo -windowstyle Hidden -file "path to script"

Now because some of these tasks run for about 1 hour to several hours I like to have them hidden, but sometimes I'd like to be able to check how the process is doing. Is there any way to make the pwsh.exe visible? or read the output of the script?

Store output to some file is the easiest way.

Script ... | Out-File C:\filename.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM