Trying to figure out where the output of a long running scheduled task is being saved. Presumably, it's in the working directory of the task. Unfortunately, the "Start in" option was not set.
The scheduled task is using the "System" account.
Any ideas?
The default working directory for a scheduled task running as the Local System account is
%Windir%\System32\
Source: I just tested it by making a scheduled task, running as SYSTEM, that executed a batch file. The batch file contained the line
ipconfig > test123.txt
. When the scheduled task is run, the test123.txt file appears in the Windows\System32 directory.Secondly, I created another task, also running as SYSTEM, but this time the executable was set to
C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe
and the argument supplied wasC:\Users\Ryan\Desktop\test.ps1
. So basically, the scheduled task was configured to run the test.ps1 Powershell script. In the Powershell script, was the lineipconfig | Out-File .\test123.txt
.The test123.txt file once again appeared in my system32 directory when the scheduled task was run.
The default working directory for a scheduled task in windows 10, running as the Current User account is %userprofile%\appdata\local\VirtualStore\Windows\SysWOW64.
You can find the directory by creating a scheduled task with something like this:
This will start a powershell session and print the working directory to a file on your desktop.