現代のエンタープライズ環境を管理することで、最も困難なIT戦士さえ汗をかくことができます - 特に頑固なエンドポイントの艦隊を再起動する必要があります。 , Python 駆動型の大量再起動ツールで、クリックごとに単調に時間がない管理者向けに設計されています. 真の Barberion のように、速度、パワー、障害に対する忍耐力ゼロであなたのマシンのリストをカットします。 BarbaricBoot BarbaricBootとは? is a command-line Python script that reads a list of computer names and unleashes parallel reboots on them, reporting every victory and defeat along the way. コンピュータ名のリストを読み、それらに並行してリブートをリリースし、途中のすべての勝利と敗北を報告します。 コマンド)は、最大限の効率のために複数のトレードを活用します. すべての失敗したリブートはログされます - 成功したリブートは、もう一つの勝利した戦いです。 BarbaricBoot shutdown なんで野蛮なの? 効率:数時間ではなく数分で何百台ものマシンを再起動します。 シンプルさ: 1 つのファイル、1 つのコマンド、最小限のセットアップ。 責任:成功と失敗に関するリアルタイムのフィードバック。 No-Nonsense Barbarian Spirit: Just reboot 'em all - no excuses, no mercy. すべてを再起動するだけです。 どのように機能する 入力:pcs.log にマシン名(一行あたり一つ)を落とします。 実行: BarbaricBoot は Python の concurrent.futures を使用して最大 20 回の並列再起動を実行します。 フィードバック:あなたは、あなたのコマンドを拒否するすべてのマシンの詳細なログを加えて、成功と失敗のリアルタイムの数値を得ます。 BarbaricBoot をインストールして使用する方法 要件 Python 3.6 またはそれ以降 Windows 管理権限(リモート シャットダウン権限) ターゲットマシンをリストする pcs.log ファイル(ラインごとに 1 つ) セットアップ **Save the Script \ Copy the complete code (provided below) to your admin machine. BarbaricBoot.py **Prepare Your Targets \ Create a plain text file called in the same directory as your script, listing each machine to be rebooted. pcs.log **Run BarbaricBoot \ Open a terminal and execute: “Python BarbericBoot.py“ 完全なコード #Another /\_[]_/\ # fine |] _||_ [| # ___ \/ || \/ # /___\ || # (|0 0|) || # __/{\U/}\_ ___/vvv # / \ {~} / _|_P| # | /\ ~ /_/ [] # |_| (____) # \_]/______\ Barberion # _\_||_/_ Production # (_,_||_,_) # import concurrent.futures import subprocess import logging from threading import Lock # Set up logging for failed reboots logging.basicConfig(filename='failed_reboots.log', level=logging.INFO) # Lock for thread-safe printing and updating counters print_lock = Lock() def reboot_machine(machine_name, success_counter, failure_counter): try: subprocess.run(['shutdown', '/r', '/t', '0', '/m', f'\\\\{machine_name}', '/f'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) with print_lock: success_counter[0] += 1 print(f"\rTotal successful reboots: {success_counter[0]}, Total failed reboots: {failure_counter[0]}", end='') except subprocess.CalledProcessError as e: with print_lock: failure_counter[0] += 1 print(f"\rTotal successful reboots: {success_counter[0]}, Total failed reboots: {failure_counter[0]}", end='') logging.error(f"Failed to reboot {machine_name}: {e}") def main(): with open('pcs.log') as file: machines = file.readlines() total_hosts = len(machines) print(f"Total hosts in file: {total_hosts}") # Shared counters for successful and failed reboots successful_reboots = [0] failed_reboots = [0] # Use ThreadPoolExecutor for parallel execution with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor: futures = [executor.submit(reboot_machine, machine.strip(), successful_reboots, failed_reboots) for machine in machines] # Wait for all tasks to complete, i suppose you can comment out for rapid fire. concurrent.futures.wait(futures) # Final print to ensure the last count is displayed correctly print(f"\nFinal count - Total successful reboots: {successful_reboots[0]}, Total failed reboots: {failed_reboots[0]}") if __name__ == "__main__": main() トップ > Customization Tips 平行性の増加または減少: 環境の寛容性に応じて、マックス_workers=20 をツイートして、より多くのまたはより少ない平行攻撃を実行します。 ログ:失敗したすべての試みは、後でレビューするために failed_reboots.log に保存されます。 Rapid Fire Option:Comment out the concurrent.futures.wait(futures) line if you want to let the script fire off and move 最終思考 BarbaricBoot は恥ずかしがりな人にはなりません。責任を持って使用し、賢く操作し、大きなパワーと大きな責任が伴うことを覚えてください。あなたのリブートが速く、あなたのログが清潔で、あなたのエンドポイントが常に合致しますように!