-1

I need to do the following things:

1) Сonnect to the server 2) Run the application E:\backup\backup.exe 3) copy E:\backup\log.txt in E:\backup\history\ 18.11.16 20-54-32.txt where the file name will be changed to the current time. 4) Disconnect from the server.

Tell me please, possible to do this the following on C #? And if its possible - preferably example or link to the necessary. Thanks.

using System;
//using Cassia;
using MSTSCLib;

namespace rdm
{
    class Program
    {
        static void Main(string[] args)
        {
            var rdp = new MsRdpClient8NotSafeForScripting();
            rdp.Server= "192.168.0.101"; //adress
            rdp.Domain = "localdomain"; //domain
            rdp.UserName = "test"; //login
            rdp.AdvancedSettings8.ClearTextPassword = "123456";//password
            try
            {
                rdp.Connect();
            }
            catch(Exception e)
            {
                Console.WriteLine(e);
            }
            Console.WriteLine(rdp.Connected);
            if (rdp.Connected != 0)
            {
                rdp.Disconnect();
            }
            Console.ReadKey(true);
        }
    }
}
Dunkan
  • 21
  • 2
  • 3
    Stack Overflow is not a code writing service. You should do some research, give something a go and then come back when you've hit a wall and ask a question that is a [mcve]. Happy Coding! – Katie Nov 26 '16 at 15:10
  • @Katie, i already try to connect but Сonnected return 0 every time and nothing happen. – Dunkan Nov 26 '16 at 15:17
  • 1
    Hi @Dunkan, and welcome to Stack Overflow, you need to take the [tour] to better understand how SO works, then you will be able to write a better question. Just trying to explain why others have downvoted your question and haven't been able to help you more easily. – Katie Nov 26 '16 at 15:22
  • @Katie, i no need code writing for me. I just want to know whether it is possible by means of language C #? And that this may be necessary. – Dunkan Nov 26 '16 at 15:40
  • 1
    Welcome to SO, @Dunkan! Regarding your question: It is possible, but you should change your question to specifically ask _how_ it is done. As Katie stated, SO isn't a code writing service. – CodenameLambda Nov 26 '16 at 16:26

1 Answers1

1

Wow....what a lot of flak for a simple can it or can it not be done?

Dunkan...yes it can.

Visit here: C# Custom Remote Desktop Client using RDP 8.0

Community
  • 1
  • 1
Ibrahim Malluf
  • 657
  • 4
  • 6