GPO – Get rid of Comic Sans

The Script

At my workplace we had a lot of people that liked to use the much maligned font, Comic Sans.  It was especially prevalent on our Intranet.  My boss and I were joking around about it, and thought it would be an interesting exercise to try and remove it from all of the computers using group policy.  I came up with a small batch file that would run at start-up and delete the two .ttf files that go along with the Comic Sans font.  This was a bit crude and had some issues, but it worked.

(Don’t use this.  Read on!)

We found that deleting the .ttf files from the computer wasn’t quite enough.  Deleting the .ttf does break the ability to use the font.  But the font is still listed in the registry, at least until the next reboot. During this time if a program such as Internet Explorer tries to call the font, IE will not do what it normally would to deal with a font that’s not there (substitute something else), and you end up with missing text on your page.  This had the side effect of generating a few help desk tickets for people trying to view certain pages on our Intranet, which in turn caused me to go through the site and replace calls for Comic Sans with something else.  I needed to do this anyway, and this is where I’m thankful for an editor with global search and replace.

No major catastrophes here but like I said, it was crude, and not really the right way to do it.  Around this time, we also decided to remove Comic Sans from our deployment images before we deployed new computers.

Fast forward a couple of years, and we found ourselves building some new images from scratch, and I realized that I forgot all about that bedeviled Comic Sans, so it crept it’s way back into some new computers.  This caused me to take another look at the code that I wrote and see if I could do it better, especially since I had gotten a little better with writing batch files.  After some more tinkering, I came up with this:

The rudown is this:

  1. Check to see if the .ttf for the standard font is even there.
  2. If it is, delete the registry entry for the font, and then the .ttf itself.
  3. Do the same thing again, but this time with the .ttf for the bold version of the font.

Pretty simple, but much more effective, and without the annoying side effects.

Group Policy

Save the code above as a batch file, and put it in a network share that can be easily accessed.  I put ours in the NETLOGON folder of one of our domain controllers.  It’s a nice central location that group policy will have no problem accessing, and will have the advantage of replicating to the DCs at our remote sites.

Create a new Group Policy Object and edit it.  You can also edit an existing policy.  I just edited our existing Default Domain Policy for this one.

Navigate to Computer Configuration > Policies > Windows Settings > Scripts.

removecs1Right-click on Startup in the viewing pane on the right, and then click on properties.

In the Startup Properties box, click on Add.  In the box that opens, click on the Browse button and navigate to the location of the script.  You will not need any script parameters for this one.  Click on OK for the script box, and then OK for the Startup box.

Now, apply the Group Policy accordingly.