LISTING 1: TestUserReplication.pl use Win32::NetAdmin qw(UsersExist); use Net::Ping; $SuccessCounter = 0; $ServerCounter = 0; BEGIN COMMENT # Open the command-shell window. END COMMENT system ("title User account replication tester"); system ("color 17"); system ("CLS"); BEGIN COMMENT # Prompt for user input and set the $User scalar variable. END COMMENT print "Please enter the UserID that you would like to test:\n\n"; chomp($User=); BEGIN COMMENT # Configure a list of the DCs you want to test. END COMMENT @DCList = qw(DOM-DC-01 DOM-DC-02 DOM-DC-03 DOM-DC-04 DOM-DC-05 DOM-DC-06 DOM-DC-07 DOM-DC-08 DOM-DC-09 DOM-DC-10); print "Server test list\n\n"; print "@DCList\n\n"; foreach $Server ( @DCList ) { print "Pinging $Server: "; # Testing ping response of server. $p = Net::Ping->new("icmp"); if ($p->ping($Server, 1)) { BEGIN COMMENT # You can comment out the following print statement if you # want onscreen status information. END COMMENT print "Online!\t"; $ServerCounter++; &TestUserExist; $p->close(); } else { print "Offline\n"; $p->close(); } } if ( $ServerCounter > 0) { print "$ServerCounter Servers Online for test.\n"; print "$User located on $SuccessCounter servers.\n"; } if ( $ServerCounter == 0) { print "No servers have responded to ping!\nCheck for network problem or server list issues.\n" } elsif ( $ServerCounter == $SuccessCounter) { print "100% replication success has been verified!!!\n" } else { $Success = ($SuccessCounter/$ServerCounter) * 100 ; $Success=sprintf("%5.1f", "$Success"); print "$Success% replication success.\n" } print "\n\nRun complete - Please hit Enter to close this window."; $pause=; BEGIN COMMENT # Use the UsersExist module to test for a user. END COMMENT sub TestUserExist { if ( UsersExist("\\\\$Server", "$User")) { print "$User account exists\n"; $SuccessCounter++; } else { print "$User account does not exist\n"; } }