All in One – System Rescue Toolkit, first week success!

Last week, I released my toolkit free for public use and download.  1 week later, over 120 unique downloads so far!  That is amazing how many people have taken an interest in such a short time frame!

Please continue to download and share this great utility that I use and hope you will enjoy using to repair common Windows Server and PC related issues!

Going forward, I will be releasing an “AiO-SRT Lite” version that contains only the 100% automated tasks and should be sufficient enough for people to download and fix some problems or at least generate log files to give to their technician to help repair common Windows PC problems.

“AiO-SRT Lite” will not contain the live CD environment or any real technician utilites and should be simple enough for the average PC user to download and run without having to do any manual tinkering “under the hood” and risk breaking stuff.

Look for the new automated “Lite” version coming soon!

Archive Old Files

One of my clients was recently merged into another business and they had an archaic system for record keeping that I call “Pile of Files”.  They wanted to go through the pile of files and folders and archive all files before the merger date.

This is the script that was the result.  Don’t take this script lightly and I would highly recommend going through the generated log file and making sure that everything is good to go before calling an archival project complete.

Also, make sure you have backups before starting any sort of data archival or migration!

Download this script

@ECHO OFF

SETLOCAL EnableDelayedExpansion

REM **************************************************
REM This is a custom script whose purpose is to:
REM - Recursively search through folders
REM - Create a list of old files based on a date
REM - Move old files to a storage device
REM - Recursively delete leftover empty folders
REM **************************************************

REM Search for files prior to the date using format MM/DD/YYYY
SET _prior_to=01/01/1900

REM Source locations, using batch "array", list each directory separately to search
REM DO NOT USE JUST DRIVE LETTERS (C:\, D:\, etc) OR THE SCRIPT WILL NOT WORK!
SET _source[0]=C:\Users\John Doe\Folder 1
SET _source[1]=C:\Stuff
SET _source[2]=S:\Old Junk
REM Set this to the last element number of _source "array"
SET _sourceLastElement=2

REM Destination location
SET _dest=D:\Archive

REM If these strings are found in a file's path, exclude them from copy/delete
SET _exclude[0]=DO NOT DELETE
SET _exclude[1]=ExcludeMe
REM Set this to the last element number of _exclude "array"
SET _excludeLastElement=1

REM **************************************************
REM NOTHING BELOW HERE NEEDS TO BE EDITED!
REM **************************************************

REM Log file location
SET _log=%UserProfile%\Desktop\archive.log
DEL "%_log%" >NUL 2>&1

REM This is a temporary file we create to hold filenames to be moved due
REM to a 253 character constraint in the FORFILES /C argument
SET _fil_temp=%TEMP%\fil_tmp
DEL "%_fil_temp%" >NUL 2>&1

REM Loop through all files from _source[N] and add them to the temporary file
REM if older than _prior_to
FOR /L %%N in (0,1,%_sourceLastElement%) DO (
 FORFILES /s /p "!_source[%%N]!" /d -%_prior_to% /C "cmd /c IF @ISDIR==FALSE ECHO @PATH>>^"%_fil_temp%^""
)

REM Loop through temporary files and perform action
FOR /F "tokens=*" %%A IN ( %_fil_temp% ) DO (
 SET _exclusionFound=
 FOR /L %%N in (0,1,%_excludeLastElement%) DO (
 ECHO "%%~DPNXA" | FIND /I "!_exclude[%%N]!" >NUL && ( 
 SET _exclusionFound=1
 )
 )
 
 IF NOT DEFINED _exclusionFound (
 ECHO XCOPY "%%~DPNXA" "%_dest%%%~PA">>%_log% 2>&1
 XCOPY "%%~DPNXA" "%_dest%%%~PA">>%_log% 2>&1
 
 IF EXIST "%_dest%%%~PNXA" (
 ECHO DEL "%%~DPNXA">>%_log% 2>&1
 DEL "%%~DPNXA">>%_log% 2>&1
 )
 )
)

REM Recursively delete all empty directories from our source folders. First
REM show all sub directories in reverse order, then remove directories with
REM RD. This command will fail for each non-empty directory.
FOR /L %%N in (0,1,%_sourceLastElement%) DO (
 REM First, clean out Thumbs.db from our _source folders
 ECHO DEL /S /F /Q !_source[%%N]!\*Thumbs.db>>%_log% 2>&1
 DEL /S /F /Q !_source[%%N]!\*Thumbs.db>>%_log% 2>&1
 ECHO DEL /S /F /Q /A:H !_source[%%N]!\*Thumbs.db>>%_log% 2>&1
 DEL /S /F /Q /A:H !_source[%%N]!\*Thumbs.db>>%_log% 2>&1
 
 FOR /F "delims=" %%A IN ('dir /s /b /ad !_source[%%N]!^| SORT /R') DO (
 SET _exclusionFound=
 FOR /L %%M in (0,1,%_excludeLastElement%) DO (
 ECHO "%%~DPNXA" | FIND /I "!_exclude[%%M]!" >NUL && (
 SET _exclusionFound=1
 )
 )
 
 IF DEFINED _exclusionFound (
 ECHO Skipping delete of "%%~DPNXA" exclusion found.>>%_log% 2>&1
 ) ELSE (
 ECHO RD "%%A">>%_log% 2>&1
 RD "%%A">>%_log% 2>&1
 )
 )
)

REM Cleanup our temporary file
DEL "%_fil_temp%" >NUL 2>&1

ENDLOCAL

Download this script

DNS based adblock using OpenWRT, OpenDNS, and dnsmasq

[Update 24 Feb 2018: I am now using a MikroTik router and have written an article to do the same kind of DNS adblocking.]

 

Why use a DNS based adblock?  Because I prefer to try to keep advertisements and pop ups off of all computers that use my internet connection, not just the ones with an ad-blocking  browser plugin installed.  It also cuts down on bandwidth usage from those auto-play advertising videos and flashing images. Continue reading “DNS based adblock using OpenWRT, OpenDNS, and dnsmasq”