Redirecting console output to a log file
问题 I am working with the WMI API for c# in order to connect to a remote server and execute some commands. I have successfully established a connection. All I need now is to redirect the output of the remote CMD into a log file in my local machine. Here is my code : ConnectionOptions options = new ConnectionOptions(); options.Username = "login"; options.Password = "password"; ManagementScope scope = new ManagementScope("\\\\myserver\\root\\cimv2", options); scope.Options.EnablePrivileges = true;