Looking for a way to automate pi-hole updates with custom addlist entries, on Windows using Docker? Here’s what I did:

Pre-reqs:

  • Download Docker for Windows and install
  • Create a new batch file, e.g. “update_pihole.bat” with the content below
    • Change the docker run parameters, e.g. change the server IP/password/TimeZone/DNS2 and DNS3 (leave DNS1 to the default 127.17.0.1)
    • Create a scheduled task on the Windows host that runs the script periodically, e.g. every month. Test the task to see if it’s working.
  • Make sure the host can resolve DNS to download the latest pi-hole container after the script stops the running pi-hole docker container. I’ve configured a secondary DNS on my Windows host to point at my ISP’s DNS server directly.
  • Change your router’s DHCP to hand out IP’s with the DNS pointing to your Windows host/pi-hole’s IP.

@echo off
REM Update a pi-hole container on Windows using Docker and adding a bunch of custom addlists 
REM Latest script can be found on http://pieter.wigleven.com/it/archives/187

REM Stop and delete existing pi-hole container
docker stop pihole
docker rm pihole

REM Clear out the Docker cache and all unused images (i.e. the out of date version of pi-hole).
docker image prune -a --force

REM Pull latest pihole container, make sure your host can resolve DNS at this point!
docker pull pihole/pihole

REM Run pihole with customized parameters (change this to match your environment)
docker run -d --name pihole -e ServerIP=192.168.1.5 -e WEBPASSWORD=abcdefgh -e TZ=Europe/Amsterdam -e DNS1=127.17.0.1 -e DNS2=8.8.8.8 -e DNS3=1.1.1.1 -p 80:80 -p 53:53/tcp -p 53:53/udp -p 443:443 --restart=unless-stopped pihole/pihole:latest

REM Add custom addlist by modifying the database (ugly but only method AFAIK...)
docker exec pihole sqlite3 /etc/pihole/gravity.db "INSERT INTO adlist (address, enabled, comment) VALUES ('https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt', 1, 'comment');"
docker exec pihole sqlite3 /etc/pihole/gravity.db  "INSERT INTO adlist (address, enabled, comment) VALUES ('https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt', 1, 'comment');"
docker exec pihole sqlite3 /etc/pihole/gravity.db  "INSERT INTO adlist (address, enabled, comment) VALUES ('https://dbl.oisd.nl/', 1, 'comment');"
docker exec pihole sqlite3 /etc/pihole/gravity.db  "INSERT INTO adlist (address, enabled, comment) VALUES ('https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt', 1, 'comment');"

REM Update Gravity to download contents of custom addlists
docker exec pihole pihole updateGravity

Consider leaving a reply if you found this to be helpful

Comments (0) Posted by pieter on Tuesday, December 21st, 2021


Since several weeks I noticed that when downloading files from the internet, after clicking a file to download – it took up to a minute before the “Open/Save/Cancel” golden bar appeared.
Very frustrating if you quickly want to download something.

The first troubleshooting step was to launch Internet Explorer 9 without any add-ons using “iexplore –extoff”. Internet Explorer reported it was running without add-ons:

After testing, the problem still occurred, it took exactly 54 seconds between the moment you clicked a file to download and the moment the dialog would appear:

54 seconds before the golden bar to appear

Now it was time to start Procmon, I downloaded the latest version from http://live.sysinternals.com and started a new process monitor session and limited the process to “iexplore.exe”

Shortly after capturing the events I initiated a download in Internet Explorer 9, just after the download dialog to appear I stopped capturing events.

I could see some delays in the trace but at first it wasn’t obvious what was causing them. After browsing through the events I noticed several references to UNC locations:

Notice the UNC locations

 

As you can see in the picture above, Internet Explorer was trying to reach my Mediacenter PC.
My mediacenter wasn’t powered on and therefore a “BAD NETWORK PATH” was logged. However – my main question was “Why is Internet Explorer looking for these locations at all?”

The default download folder for IE9 is a folder on my local drive, therefore I was wondering why IE9 was looking in places I – probably – previously downloaded files to.

A quick search through the Windows Registry didn’t reveal this information to be stored anywhere. That’s when I had a look in the “Download History” in IE9, you can access this by hitting CTRL-J. In my case it took another 54 seconds before the download history dialog to appear. This is where I could see the references to my Mediacenter PC.

After clearing the list I tested the download functionality and this time it the golden bar would appear immediately.
Thanks to Procmon we now know that IE9 tries to reach to previous download locations, including UNC locations to unreachable machines.

Another case closed thanks to Procmon.

Comments (5) Posted by pieter on Tuesday, January 17th, 2012


Solve this by either:

– Assign the destination drive/partition a driveletter

– Change the destination drive/partition driverletter to something else (this solved it for me)

E.g.

Comments (2) Posted by pieter on Tuesday, November 22nd, 2011


When closing a Windows Explorer window, the next time you open it the size of the preview pane isn’t remembered. Frustrating?

The solution is simple.

  1. Resize the window and preview pane just like you want to have it
  2. Hold CTRL-SHIFT on your keyboard while closing the explorer window (e.g. clicking the little X on the upper right corner)

Next time when you launch explorer you’ll see that the settings are remembered!

Comments (3) Posted by pieter on Tuesday, May 24th, 2011


I’ve been asked to fix a computer that seemed to have a lot virusses. One rootkit preventing internet access to the Windows Update server. I fixed this using TDSSKILLER

After this I could at least visit http://update.microsoft.com but received a 0x8024D007 error.
To fix this:

1) Open the registry (start/run/regedit) and browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\wuauserv

2) Right click wuauserv in the left pane and select “Permissions” make sure you have:

– System at FULL CONTROL
– Administrators at FULL CONTROL

(if you mis these entries you can add them using the add button).

3) Now using the same registy editor browse to:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Svchost

4) Right click Svchost in the left pane and select “Permissions” make sure you have:

– System at FULL CONTROL
– Administrators at FULL CONTROL

Close the registry editor

5) Download the latest Windows Update Client using this link
Leave me a quick reply if it helped you, good luck!

Comments (30) Posted by pieter on Thursday, September 16th, 2010


The Win7 RTM SDK is out, and with it the latest public version of Windows Performance Toolkit (which contains XPERF).

 

The SDK is huge but the lightest way to get WPT is to:

 

1)      Launch the installer from here: http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en

a.       Note this is the “web” installer which only downloads the components that you choose to install

2)      Choose to install the Development Win32 Tools

3)      Find the wpt installer MSI’s (wpt_xxx) under C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin

Comments (0) Posted by pieter on Friday, September 4th, 2009


Took me a while to find out but this is the solution:

1) Install the game, if you run into problems at this stage, set the MafiaLauncher.exe and MafiaSetup.exe executables on CD1 to Compatibility Mode: Windows XP SP2. If it fails, execute it as an administrator.

2) Go into C:\Program Files\Mafia en set the executable Game.exe to Compatibility Mode: Windows XP SP2

3) Go out and search the web for an update to 1.2 (mafia_patch_1.2_eng.exe). On the web you will find sites which refer to patch 1.3 and 1.2, there is no difference. I found it here .

4) Go into C:\Program Files\Mafia en execute Setup.exe. Make sure you configure it as follows:

Mafia Config

5) Now sometimes you might be able to play now, if not, follow the next step. You can test this by playing an intro.avi from the c:\program files\mafia folder. If you have video, your good to go!

6) In order to play the intro movies of Mafia (and play the game), you need and Indeo codec. This is unsupported on Vista (as a matter of fact, starting Windows XP SP1 and higher). Go out and fetch a freeware Indeo codec. I’ve got it from this site. Starting from version 5.2 you have to pay for it so make sure you find an older one 🙂

7) Open a command prompt with elevated right (hit the start button, type CMD, right click it and choose  “Run as an administrator”. In the console type: regsvr32 ir50_32.dll

8 ) Try to play the game and please leave a comment if this guide helped you out (or not)!

Comments (164) Posted by pieter on Tuesday, November 4th, 2008


I had this issue after running the Bitlocker Drive Preperation tool.
After this i ended up with two partitions:

C: Partition of 1,5 GB (for boot files)
D: Partition of 148 GB (Windows and everything)

My BCD (former boot.ini) showed the right stuff but somehow my Windows still wouldn’t boot.
After starting up with a Windows Vista install CD and choosing “Repair my computer” I could access a command prompt.

After executing bootrec /fixboot my machine booted properly and my machines is bitlocker ready 😉

Comments (2) Posted by pieter on Monday, October 13th, 2008


There are two options to get rid of this error in your userenv log:

1) Setting the following registry configuration:

Hive:  HKCU
Path:  Software\Microsoft\Windows NT\CurrentVersion\Winlogon
Key:   ParseAutoexec
Value: 0 = autoexec.bat is not parsed
          1 = autoexec.bat is parsed

2) Create an autoexec.bat in the root of your system drive.

echo “@echo off”>>c:\autoexec.bat

Comments (0) Posted by pieter on Monday, August 25th, 2008


64 core + 256Gb RAM, yes it’s true, no photoshop. Click image for bigger version!

 

Comments (0) Posted by pieter on Thursday, July 17th, 2008