in reply to tasklist command not working

Output from system never goes through perl, so you cannot capture either STDERR or STDOUT via simple redirects like you have attempted. You would get something much closer to what you expect with backticks (see `STRING`):

open (OLDOUT, ">&STDOUT"); open (STDOUT, ">c:\\Temp\\STDOut.txt") or die "Can't open STDOUT: $!"; print `tasklist /S 10.9.79.251 /U sagarkha /P ******`;

or possibly

print `tasklist /S 10.9.79.251 /U sagarkha /P ****** 2>&1`;

If, on the other had, you need to keep your error stream and output stream independent, you will need to do some interprocess communication -- see, for example, perlipc or IPC::Open3.