public void EnumerateDfsRoot() { Console.WriteLine("Network.Host.EnumerateDfsRoot()"); int cnt = 0; StopWatcher(true); // Drill down to get servers from the first namespace retrieved. try { foreach (string dfsName in Host.EnumerateDomainDfsRoot()) { Console.Write("\n#{0:000}\tDFS Root: [{1}]\n", ++cnt, dfsName); try { DfsInfo dfsInfo = Host.GetDfsInfo(dfsName); foreach (DfsStorage storage in dfsInfo.NumberOfStorages) { int cnt2 = 0; Console.Write("\n\tEnumerating DFS Namespaces from host: [{0}]\n", storage.ServerName); foreach (string dfsNamespace in Host.EnumerateDfsRoot(storage.ServerName, true)) { Console.Write("\t#{0:000}\tDFS Root: [{1}]\n", ++cnt2, dfsNamespace); //ShareInfo share = Host.GetShareInfo(storage.ServerName, storage.ShareName, true); //Dump(share, -18); } } } catch (NetworkInformationException ex) { Console.WriteLine("\n\tNetworkInformationException #1: [{0}]", ex.Message.Replace(Environment.NewLine, " ")); } catch (Exception ex) { Console.WriteLine("\n\tException (1): [{0}]", ex.Message.Replace(Environment.NewLine, " ")); } } Console.Write("\n\t{0}", Reporter(true)); Assert.IsTrue(cnt > 0, "Nothing was enumerated."); } catch (NetworkInformationException ex) { Console.WriteLine("\n\tNetworkInformationException #2: [{0}]", ex.Message.Replace(Environment.NewLine, " ")); } catch (Exception ex) { Console.WriteLine("\n\tException (2): [{0}]", ex.Message.Replace(Environment.NewLine, " ")); } Console.WriteLine("\n\n\t{0}", Reporter(true)); Assert.IsTrue(cnt > 0, "Nothing was enumerated."); Console.WriteLine(); }
public void EnumerateDfsRoot() { Console.WriteLine("Network.Host.EnumerateDfsRoot()"); int cnt = 0; bool noDomainConnection = true; StopWatcher(true); // Drill down to get servers from the first namespace retrieved. try { foreach (string dfsName in Host.EnumerateDomainDfsRoot()) { noDomainConnection = false; Console.Write("\n#{0:000}\tDFS Root: [{1}]\n", ++cnt, dfsName); try { DfsInfo dfsInfo = Host.GetDfsInfo(dfsName); foreach (DfsStorageInfo storage in dfsInfo.StorageInfoCollection) { int cnt2 = 0; Console.Write("\n\tEnumerating DFS Namespaces from host: [{0}]\n", storage.ServerName); foreach (string dfsNamespace in Host.EnumerateDfsRoot(storage.ServerName, true)) { Console.Write("\t#{0:000}\tDFS Root: [{1}]\n", ++cnt2, dfsNamespace); } } } catch (NetworkInformationException ex) { Console.WriteLine("\n\tNetworkInformationException #1: [{0}]", ex.Message.Replace(Environment.NewLine, " ")); } catch (Exception ex) { Console.WriteLine("\n\tException (1): [{0}]", ex.Message.Replace(Environment.NewLine, " ")); } } Console.Write("\n\t{0}", Reporter(true)); Assert.IsTrue(cnt > 0, "Nothing was enumerated."); } catch (NetworkInformationException ex) { Console.WriteLine("\n\tNetworkInformationException #2: [{0}]", ex.Message.Replace(Environment.NewLine, " ")); } catch (Exception ex) { Console.WriteLine("\n\tException (2): [{0}]", ex.Message.Replace(Environment.NewLine, " ")); } Console.WriteLine("\n\n\t{0}", Reporter(true)); if (noDomainConnection) { Assert.Inconclusive("Test ignored because the computer is probably not connected to a domain."); } else { Assert.IsTrue(cnt > 0, "Nothing was enumerated."); } Console.WriteLine(); }