Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
2.4 KiB

  1. @rem = '
  2. @goto endofperl
  3. ';
  4. $USAGE = "
  5. Usage: $0 datafile
  6. topchk takes the output of \"ntfrsutl ds\" and summarizes the topology.
  7. ";
  8. die $USAGE unless @ARGV;
  9. printf("\n\n");
  10. $linenumber = 0;
  11. $InFile = "";
  12. $bx = 0;
  13. $hx = 0;
  14. $remx = 0;
  15. $errorcount = 0;
  16. while (<>) {
  17. if ($InFile ne $ARGV) {
  18. $InFile = $ARGV;
  19. printf("Processing file %s \n\n", $InFile);
  20. $infilelist = $infilelist . " " . $InFile;
  21. $linenumber = 0;
  22. }
  23. $linenumber++;
  24. chop;
  25. ($func, @a) = split(":");
  26. if (($func eq "") || ($func =~ m/^#/)) {next;}
  27. #
  28. # /rem <text>
  29. #
  30. if ($func =~ m/\Computer DNS Name/) {
  31. printf("%s\n", $_);
  32. # $rem[$remx] = $_;
  33. # $rem[$remx] =~ s/\/rem//i;
  34. # $remx += 1;
  35. next;
  36. }
  37. if ($func =~ m/^ MEMBER/) {
  38. ($junk, $member) = split;
  39. #printf("%s\n", $_);
  40. next;
  41. }
  42. if ($func =~ m/^ CXTION/) {
  43. ($junk, $cxtion) = split;
  44. #printf("%s\n", $_);
  45. next;
  46. }
  47. if ($func =~ m/Server Ref/) {
  48. #printf("%s\n", $_);
  49. #Server Ref : CN=NTDS Settings,CN=C0010000,CN=Servers,CN=0100Site,CN=Sites,CN=Configuratio...
  50. ($hostsrv, $hostsite) = m/cn=ntds settings,cn=(.*),cn=servers,cn=(.*),cn=sites/i;
  51. next;
  52. }
  53. if ($func =~ m/Partner Dn/) {
  54. #printf("%s\n", $_);
  55. # Partner Dn : cn=ntds settings,cn=c0int01,cn=servers,cn=credit1,cn=sites,cn=config
  56. ($fromsrv, $fromsite) = m/cn=ntds settings,cn=(.*),cn=servers,cn=(.*),cn=sites/i;
  57. # printf("cxtion: %s host: %s\\%s from: %s\\%s\n", $cxtion, $hostsite, $hostsrv, $fromsite, $fromsrv);
  58. $from = $fromsite . "\\" . $fromsrv;
  59. $host = $hostsite . "\\" . $hostsrv;
  60. $fromlist{$from}++;
  61. $hostlist{$host}++;
  62. next;
  63. }
  64. #
  65. # Day 1: 010000000000010000000000
  66. #
  67. if (m/Day 1\:/) {
  68. ($junk, $junk2, $schedule) = split;
  69. printf("cxtion: %s host: %s\\%s from: %s\\%s Sched: %s\n",
  70. $cxtion, $hostsite, $hostsrv, $fromsite, $fromsrv, $schedule);
  71. next;
  72. }
  73. }
  74. printf("\n\n Servers referenced from cxtions (From List) \n\n");
  75. foreach $param (sort keys(%fromlist)) {
  76. printf("%-25s %d\n", $param, $fromlist{$param});
  77. }
  78. printf("\n\n Servers hosting cxtions (Host List) \n\n");
  79. foreach $param (sort keys(%hostlist)) {
  80. printf("%-25s %d\n", $param, $hostlist{$param});
  81. }
  82. exit;
  83. __END__
  84. :endofperl
  85. @perl %~dpn0.cmd %*