Exemple #1
0
        /// <summary>
        ///   Disconnectes the given session
        /// </summary>
        /// <param name = "sessionname">name of the session</param>
        public static void DisconnectSession(string sessionname)
        {
            ICifsSession session = LookupSession(sessionname);

            if (session == null)
            {
                throw new CifsIoException("SS2", sessionname);
            }

            session.Disconnect();
        }
Exemple #2
0
        private static void DoRemoteAdmin()
        {
            var login           = new CifsLogin("guest", null);
            ICifsRemoteAdmin ra = null;

            try
            {
                // in this example, "test" is the session name, "athena" the hostname.
                // you can enter any validly resolving entry for the hostname (IP, computername, etc)
                ra = CifsSessionManager.ConnectRemoteAdmin("test", "athena", login);

                ShowServer(ra);

                Console.WriteLine("\nShare's");
                DoShares(ra);

                Console.WriteLine("\nWorkstation Info");
                DoWInfo(ra);

                Console.WriteLine("\nServer Info");
                DoSInfo(ra);


                Console.Read(); // pause

                ICifsSession s = ra;

                s.Disconnect();
            }
            catch (Exception) // ignore all
            {
                if (ra != null)
                {
                    ICifsSession s = ra;
                    s.Disconnect();
                }
            }
        }