sub enable_accounts { my @usernames = @_; open VBS, ">$TMPVBS" or die "Can't write $TMPVBS $!\n"; print VBS "Dim oContainer\n"; for (@usernames) { my @data = split ','; chomp (my $username = pop @data); print VBS qq' Set oContainer=GetObject("LDAP://CN=$username,$OU,$DC") oContainer.AccountDisabled = False oContainer.SetInfo\n'; } print VBS "\nSet oContainer = Nothing"; close VBS; print "Enabling new accounts....."; `$tmpvbs`; print "Done!\n"; unlink $TMPVBS unless $DEBUG; }