简体   繁体   中英

How to redirect powershell output within batch file ( when run from Task Scheduler)?

i'm running a batch file from Task Scheduler wich i excecute a Powershell Scripts. So , i have a batch file (TestFD.bat) :

Powershell -Command "& {C:\Users\csadouni\Desktop\testFDCOMM.ps1}" > logFDCOM.txt 

My script powershell do migration of my documents on my SharePoint Online site and it's work well (the log file is genrated perfectly) if i call the batch file from cmd.exe. Then From the task Windows he work well but the issue seem on task windows doesn't recognize my output file redirection. So no file generated

I tried all thoses solutions , but no one resolve my issue.

How to redirect powershell output when run from Task Scheduler?

Executing PowerShell from Windows Task Scheduler

How to execute a PowerShell script automatically using Windows task scheduler?

I wouldn't running only my PSscript directly from Scheduler Task , beacuse i need my output redirection of my Sharegate transfer (Sharegate is a product to automate task , manage , adminster and migtrate site , content on SharePoint & Office 365) , So , i need my output of Powershell migration after i have many other scripts to schedule them on my batch file. What am I missing?

Any help it's appreciated thanks !

您可以将PowerShell输出记录到PowerShell脚本中的文件中,而不是在调用脚本时记录批处理输出。

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