I have an ASP page that is trying to output scheduled task of a remote server
WshShell.Run "Cmd.exe /c schtasks /query /v /s Server2 /fo csv >> C:\Program Files\Scheduled Tasks\Server2\Task.csv"
1. I believe my target file is invalid because of the spaces in file name. Anyway I can resolve the spaces without using DOS short names
- for testing, I output the result to C:\TestTask.csv
2. I have at least 12 scheduled tasks and the query returned no records (empty output file not even the header)
- for testing I run this (schtasks /query /v /s Server2 /fo csv >> C:\TestTask.csv) on the command prompt and records were returned
- again, for testing, I replaced the remote server name with the host server name (Server1) on the asp page and it worked.
- Somehow the ASP page cannot configure Server2
3. After I resolve 1 and 2, I need to output result to the page. The csv file contains 28 columns and incudes all scheduled task (including Disabled Task).
How do I query the csv file and only output specific columns and only tasked that are not disabled?
Any help will be greatly appreciated.
WshShell.Run "Cmd.exe /c schtasks /query /v /s Server2 /fo csv >> C:\Program Files\Scheduled Tasks\Server2\Task.csv"
1. I believe my target file is invalid because of the spaces in file name. Anyway I can resolve the spaces without using DOS short names
- for testing, I output the result to C:\TestTask.csv
2. I have at least 12 scheduled tasks and the query returned no records (empty output file not even the header)
- for testing I run this (schtasks /query /v /s Server2 /fo csv >> C:\TestTask.csv) on the command prompt and records were returned
- again, for testing, I replaced the remote server name with the host server name (Server1) on the asp page and it worked.
- Somehow the ASP page cannot configure Server2
3. After I resolve 1 and 2, I need to output result to the page. The csv file contains 28 columns and incudes all scheduled task (including Disabled Task).
How do I query the csv file and only output specific columns and only tasked that are not disabled?
Any help will be greatly appreciated.