Skip to content

Instantly share code, notes, and snippets.

@Darkhand81
Darkhand81 / PrinterTools-v5.0.ps1
Created June 1, 2021 03:51
Darkhand's print spooler tools v5.0 - Use this to remotely query or restart the print spooler of a given machine. Also can reboot the machine remotely (untested).
# ------------------------------------------------------------------------------------------------------------------------------
#
# Darkhand's print spooler tools v5.0
#
# Use this to remotely query or restart the print spooler of a given machine. Also can reboot the machine remotely (untested).
#
# ------------------------------------------------------------------------------------------------------------------------------
#
#
# Changes in v5.0:
@Darkhand81
Darkhand81 / SpoolerQuery.bat
Last active June 22, 2020 21:07
Interactive batch file that queries the spooler service on a given machine and restarts it if stopped. Run at an elevated command prompt. (V2 - Check for machine on network before starting spooler)
@echo off
:query
echo:
set /P machine="Enter machine name to query: "
Rem Make sure the system exists on the network
sc \\%machine% query spooler | find /I "FAILED">nul
if "%errorlevel%"=="1" (
goto :lookup
@Darkhand81
Darkhand81 / RestartSpooler.bat
Created June 22, 2020 20:32
Monitor the print spooler service on a given machine and restart it if it stops. Run in an elevated command prompt.
@echo off
:query
Rem Look for the Print Spooler service in the list of started services
sc query spooler | find /I "STATE" | find "RUNNING">nul
Rem if not found, start it and a restart occurred.
if "%errorlevel%"=="1" (
echo Service "Print Spooler" restarted at %time% on %date% by Script %0>>ServiceRestart.Log
sc start spooler>nul
)
@Darkhand81
Darkhand81 / pump_controller.ino
Created February 27, 2016 09:02
Arduino sketch to control a set of 3 sump pumps
/*
--Window well pump controller--
This Arduino sketch controls the pumps in the basement window wells.
Operation:
Each window well has its own pump and float sensor. When a sensor is
triggered, its pump activates. When the sensor clears, a timer starts
and the pump continues to run for the duration defined in the
@Darkhand81
Darkhand81 / disable_rsync_script
Created September 4, 2015 14:32
Data redundancy bash scripts for the PiKeeper NAS project
#!/bin/bash
# ------------------------------------------------
# PiKeeper sync disable script
# This file should typically be placed in:
# /etc/smartmontools/run.d/
# ------------------------------------------------
# Configuration: