Skip to content

Instantly share code, notes, and snippets.

aplocher / FixSynaptics.bat
Created May 22, 2016
Since upgrading to Windows 10 the Synaptics driver will occasionally become unstable (specifically when explorer.exe dies) and cause the mouse cursor to lock up for a few seconds every couple of minutes. I've experienced this on my HP Elitebook 8470p and Elitebook 840G2, but it's likely occuring on any laptop with a Synaptics touch pad in Win10.…
View FixSynaptics.bat
@echo off
taskkill -f -im syntpenh.exe
pushd C:\Program Files\Synaptics\SynTP
start "" "syntpenh.exe"
timeout /t 2 /nobreak >nul
exit /b
aplocher / FixStoreApps.ps1
Last active Feb 18, 2021
Fix for Remove-AppxPackage error "HRESULT: 0x80073CFA, Removal failed The system cannot find the file specified.". Requires psexec to be installed
View FixStoreApps.ps1
param (
[switch]$Relaunched = $false
$ScriptPath = (Get-Variable MyInvocation).Value.MyCommand.Path
function StartOperation {
Write-Host Now attempting to regenerate missing manifest files...
aplocher / Backup.bat
Last active Apr 26, 2016
Sync two folders using VSS. Handy for syncing source code with a backup destination on OneDrive
View Backup.bat
@echo off & setlocal enabledelayedexpansion
:: Backup.bat:
:: Adam Plocher - -
:: --Description:
:: Synchronize (backup) a directory to another dir using VSS (volume shadow copy
:: service) in Windows to help ensure a successful copy without locked files
:: impeding the process.
:: Can be called from command line or can be used to install a scheduled task
aplocher / ArpHosts.ps1
Created Jan 11, 2016
Output based on (and similar to) arp -a, but includes hostnames. Will take a few seconds longer to run since it must reverse resolve each IP.
View ArpHosts.ps1
$hostColWidth = 40
arp -a | % {
try {
if ($line -like "Interface:*" -or $line -eq "") {
} elseif ($line -like "Internet Address*") {
" " + "HostName".PadRight($hostColWidth, ' ') + $line
} else {
$res=[System.Net.Dns]::gethostentry($line.ToString().Trim().Split(" ")[0])
aplocher / patch3800sw.ps1
Last active May 20, 2021
Patch router firmware files for WNDR3800SW (SureWest specific) router model. Can convert any Netgear WNDR3800 firmware img to work with WNDR3800SW. Requires perl.exe currently.
View patch3800sw.ps1
# Patch firmware .img files used for Netgear WNDR3800 routers to work with Netgear WNDR3800SW
# The SW model routers are specfic to SureWest Communications (ISP from northern CA)
# The routers are identical, but require a different header on the .img file. This should work with any
# .img file that works with a WNDR3800, including DD-WRT, OpenWRT, and the Netgear factory firmware
## Usage: .\patch3800sw <input img file path> <output img file path>
## Example: .\patch3800sw openwrt-ar71xx-generic-wndr3800-squashfs-factory.img openwrt-wndr3800sw.img
aplocher / SingleLineAddUser.bat
Last active Apr 28, 2020
A single-line group of commands to add a user with password, and add to a security group. I got too much time on my hands...
View SingleLineAddUser.bat
rem UBER COMMAND!! (v2)
rem One-liner (technically) - prompts for User, Pass, SecGroup. Includes validation, pre-checks for UAC elevated privileges, checks for user pre-existence and group existence before running, requires a User and Group.
cmd /v /c "cls&(net file >nul 2>&1 && ((set /p "u=Enter username: "&&(net user !u! >nul 2>&1&&echo Error: user !u! already exists||(set /p "p=Password: "& set /p "g=Security Group: "&&(net localgroup !g! >nul 2>&1&& (net user !u! !p! /add>nul&&net localgroup !g! /add !u!>nul&&echo SUCCESS: Added new user !u! to group !g!&net user >nul 2>&1)|| (echo Error: specified group does not exist & net user >nul 2>&1))||(echo Error: you must specify a group)))||echo Error: user must not be blank)) || echo Error: you should run as admin)&echo.&echo.&pause"
rem Not-so-UBER command (v1)
rem One-liner, set the User, Pass, Group in the beginning of the command. No prompts, no validation. Lame.
cmd /v /c "set u=myUser&set p=password1&set g=Administrators&cls&net user !u! !p! /add>nul 2>
aplocher / WindowsToolbarAutomation.ahk
Created Aug 31, 2015
AutoHotKey script to automate adding a toolbar to the taskbar in Windows
View WindowsToolbarAutomation.ahk
; Automates adding a toolbar to the taskbar in Windows
#SingleInstance force
; Change to the folder path to your toolbar
ControlGet, handle, Hwnd,, TrayClockWClass1,,Notification Area
ControlClick, ,ahk_id %handle% ,,Right
WinWait,ahk_class #32768,,5
if ErrorLevel
aplocher / AnyConnect.ahk
Last active Feb 25, 2021
AutoHotKey script for Cisco AnyConnect. Takes hostname, username, and password as external args. Great for creating multiple shortcuts if you have more than one AnyConnect VPN.
View AnyConnect.ahk
; Create a shortcut to this file in Windows for each AnyConnect VPN configuration you need
; Each shortcut can have a different host, user, and pass defined (3 command line args)
; Usage: AutoHotKey.exe AnyConnect.ahk hostname username password
#SingleInstance force
if 0 < 3 ; The left side of a non-expression if-statement is always the name of a variable.
MsgBox This script requires at least 3 incoming parameters but it only received %0%.
aplocher / BackupDismFeatures.ps1
Created Aug 22, 2015
Small PowerShell script that looks at the currently installed Windows Features on the current system and generates a dism.exe/ cmd.exe command to be used to restore those features. Handy for when you're reinstalling Windows on a machine and want to backup / restore your IIS, Hyper-V, etc configuration.
View BackupDismFeatures.ps1
Get-WindowsOptionalFeature -Online | where State -eq Enabled | %{$o += ("/FeatureName:"+$_.FeatureName+" ")}
Write-Host "dism.exe /Online /Enable-Feature $o/All"
aplocher / FixWinUpdateOnWin10.bat
Created Jun 13, 2015
Fix Windows Update issues with Windows 10 (could likely fix issues experienced in Win 8.1 and earlier, too)
View FixWinUpdateOnWin10.bat
@echo off
:: Windows 10 Update issues
:: Stop / Disable Windows Update
sc config wuauserv start=disabled
taskkill /f /fi "SERVICES eq wuauserv"
net stop wuauserv
:: Clean temp files [where modified date not within the last 24 hours]
powershell.exe -ExecutionPolicy Bypass -Command "Get-ChildItem $env:temp | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Force -Recurse"