Managing a modern enterprise environment can make even the toughest IT warriors sweat—especially when you need to reboot a fleet of stubborn endpoints. Enter BarbaricBoot, a Python-powered mass reboot tool, crafted for admins who don’t have time for click-by-click monotony. Like a true Barberion, it cuts through your list of machines with speed, power, and zero patience for obstacles.
What is 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. Perfect for Windows-centric environments (thanks to its use of the shutdown
command), it leverages multi-threading for maximum efficiency. Every failed reboot is logged—every successful reboot is another battle won.
Why BarbaricBoot?
- Efficiency: Reboots hundreds of machines in minutes, not hours.
- Simplicity: One file, one command, minimal setup.
- Accountability: Real-time feedback on successes and failures.
- No-Nonsense Barbarian Spirit: Just reboot ‘em all—no excuses, no mercy.
How It Works
- Input: Drop your machine names (one per line) into
pcs.log
. - Execution: BarbaricBoot attacks using Python’s
concurrent.futures
to launch up to 20 parallel reboots at once. - Feedback: You get real-time counts of success and failure—plus detailed logs of any machines that refuse your command.
How To Install and Use BarbaricBoot
Requirements
- Python 3.6 or newer
- Windows admin privileges (for remote shutdown rights)
- A
pcs.log
file listing your target machines (one per line)
Setup
- **Save the Script
\ Copy the complete
BarbaricBoot.py
code (provided below) to your admin machine. - **Prepare Your Targets
\ Create a plain text file called
pcs.log
in the same directory as your script, listing each machine to be rebooted. - **Run BarbaricBoot \ Open a terminal and execute: “Python BarbericBoot.py“
The Complete Code
#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
- Increase or Decrease Parallelism: Tweak
max_workers=20
for more or fewer parallel attacks, depending on your environment’s tolerance. - Logging: All failed attempts are stored in
failed_reboots.log
for later review. - Rapid Fire Option: Comment out the
concurrent.futures.wait(futures)
line if you want to let the script fire off and move
Final Thoughts
BarbaricBoot is not for the timid. Use it responsibly, wield it wisely, and remember: with great power comes great responsibility. May your reboots be swift, your logs clean, and your endpoints ever-compliant!