TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Matt Altman
NA
3
2.5k
Redirect process output
May 24 2011 12:22 PM
Hey all,
I am working on a project that will query scheduled tasks running on other systems. I have written a console application that runs schtasks and redirects the output to a text file. However, I was wondering if it is possible to redirect this output to a SQL database?
I was thinking of writing a stored procedure which will handle all of the inserts but I don't know what to do with the data inside the console app. I already have a stored proc that redirects XML data to a database but I am trying not to have files laying around every where.
Any input would be great. Here is my code in case anyone wants to see it:
Process process = new Process();
process.StartInfo.FileName = "C:\\Windows\\System32\\schtasks.exe";
process.StartInfo.Arguments = "/query /s 192.168.0.124";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
string procOutput = process.StandardOutput.ReadToEnd();
Below here is just the redirection to a text file using a text writer.
Reply
Answers (
1
)
Varamozhi Editor for c sharp
Writing to a File