Clearing Font Caches

Wrote up a handy script to clear all the font caches for the Mac OS, Adobe, MIcrosoft Office and Apple iWorks.

I am using this in Casper, so I have it running as root and having a reboot happen after.  If you are going to run this on your own, you may want to put a root check in there and make sure to reboot after.

## Author: C. Tangora
## Purpose: Remove Font Cache from Adobe, Microsoft, iWork and Mac OS.
## If run outside of Casper, be sure to be root & reboot after.

## Adobe Font Caches are stored in the User's Libraries, and will have "Fnt" in the name and end in ".lst".
echo "Removing Adobe Font Caches (Lists)"
find -x /Users -mindepth 5 -type f -iname *Fnt*.lst -delete
sleep 1

## Next it will remove the font caches from Microsoft Office.
echo "Removing Office Font Caches"
find -x /Users -mindepth 7 -type f -name *Office\ Font\ Cache* -delete
sleep 1

## iWorks is next on the chopping block
echo "Removing iWork Font Caches"
find -x /Users -type f -name -delete
sleep 1

## Next we will restart the Apple Type Server.
# This is the one we want to make sure we reboot (or at least logout) to restart.
echo "Removing OS Font Caches"
atsutil databases -remove
sleep 1

echo "Restarting Apple Type Service Server"
atsutil server -shutdown
atsutil server -ping
sleep 1
echo "Completed Font Clearing."
echo "Please restart ASAP."

exit 0
’till next time
Printers are from hell

Setting Default Printer in Windows 7 with GPO (and a VB Script)

Printers are from hell

Sometimes Printers Just Print What They Want, Where They Want, When They Want

Previously I mentioned using the “Deployed Printers” of GPO’s to push printers to lab machines.  This works great so far but doesn’t solve one problem, the default printer.

While there are lots of options for how to set a default printer, we have the AD architecture to be able to have each lab/area have a specific GPO.   We also have a GPO that covers all the areas.  The higher GPO installs a script (I called it AssignDefaultPrinter-Arguement.vbs) into our standard script location.  This script can be called upon to set a printer as default dynamically.  Here’s the script, before we discuss more.

'  Script to set default printer via passed argument.
'  Taken from
'  Modified by C. Tangora to have a printer passed as an argument.

Option Explicit
Dim objPrinter
Dim objArgs

WScript.Sleep 1000

Set objArgs = Wscript.Arguments
Set objPrinter = CreateObject("WScript.Network")
objPrinter.SetDefaultPrinter objArgs(0)

The script can then be called on individual logon scripts (administered by the GPO for the specific area), without the need to specialize each script.  Since the script is in the same location for all machines, you just call the script and pass the printer you want to have as the default as the argument.  I would suggest using the quotation marks around the argument, as the arguments are separated by spaces.

A test run of this would be for a printer that was setup via the deployed printers, //printserver/LAB100A Color is the server and name of the printer.  To get it to be the default we run ….

AssignDefaultPrinter-Argument.vbs "//printserver/LAB100A Color"

… and in a few seconds (I built in some time to wait for printers to get in place in case they aren’t), the default printer gets assigned.

There may be other ways to skin this cat, and the code could be a bit cleaner, but I am not a big VBScripter, I’m a BASH kind of guy.  If I decided to forgo my UNiX love and dive deeper into Microsoft scripting, I promise to come back and make this cleaner.

Till next time.

Deploying Windows 7 Printers (really, really easy way) with GPO’s

So we spent days trying to figure out how to get the right printers to the Windows 7 machines.  In XP we utilized a script that ran at login, however that required a window that popped up and stayed up for 30 seconds or so for every user. This script was managed through Ghost, and since we are trying to avoid using Ghost we spent days figuring out how to get GPO’s to do the printer pushes.  Hopefully if you are trying to do the same we can cut down your research time.

We combed the web, we tried multiple approaches, scripts, GPO’s, scripts pushed through GPO’s.  When we tried pushing multiple printers through the Printers option (inside of Both Computer & User Preferences -> Control Panel Settings -> Printers) we had a very strange effect.  Only three printers were being displayed, but if you refreshed the Devices & Printers window a new set of three would show.  We were about to give up when I went back to the GPO’s.

Suffering from slight memory loss I couldn’t remember where the GPO’s we used were.  So I just started from the top and went opened each of the folders to find the “Printers”.  Low and behold I found a different option, “Deployed Printers”.  So I opened it up, thinking that this was the location, but it wasn’t.  So I went and found the original “Printers” and disabled the printers and headed back to my new friend, “Deployed Printers”.

If you have dealt with the “Printers” section of GPO’s, then you know it can be a hassle.  However, the “Deployed Printers” were just the opposite.  You put the server and printer queue name in and whala!  This supports multiple printers, and is super fast.

My coworkers & myself must have seen the “Deployed Printers” under the Comp/User Policies -> Windows Settings at least 100 times, but never realized it’s potential.  We were focusing a bit to much on what Google said rather than just getting down and dirty with the program (Group Policy Management Editor) like we used to before the days of Google.  Being able to get information through Google is essential for IT work, but nothing beats getting your hands dirty.

After creating 30+ new OU’s and GPO’s (which we planned on doing before this) we are now ready to start pushing out the printers from our AD/PaperCut print server to our Windows 7 machines.  The printers come in quicker than they did with any other method we tried, and removal of printers is as easy as removing the printer setting from the GPO.

There is one downside, you can not set the default printer from this window.  However, since the majority of the work is done (getting the printers properly deployed to the workstations), we decided to delay re-visiting the default printers, as it’s priority was lower.

Virtual Box, the easy way with Casper

We’ve been deploying VirtualBox on a one-to-one basis for the past year.  Each time someone requested vBox we would get their machine and install it.  Casper came along, and after some politics, we decided to give it a shot at building a Virtual Box installer with Windows 7 built-in.  While the end result still requires some hands-on to modify some settings (such as computer naming & binding to the AD), it is by far faster and easier to get a Mac to run Windows 7 in Virtual Box now.

The following are some considerations when planning your vBox.

  1. Not all software is legally allowed to be distributed “on image”.  Sometimes you’ll have to create a post-install process to do this (such as a GPO or Kace, BigFix, etc).
  2. Binding requires unique name, so you’ll want to bind after it is deployed.
  3. Do not have multiple partitions on the windows drive, you won’t be able to use the dynamic disk size of Virtual Box if your second partition has space left on it.
  4. You’ll want to make sure you setup the storage area to be in a shared space, so it is accessible by more than just the user who created the package.

These are just some of the warnings, however the pay-off is worth it.  If you have a paid application for virtualization (Parraellels, VMWare) it is far easier than with vBox (in my opinion), but again you can’t beat the price of Virtual Box.  That advantage of Casper is that you can push the user preferences for VirtualBox out as a separate package, available For Exisiting Users, or For User Template.  We’re in the testing stages now, but if all goes as planned, we’ll have a simplified Virtual Box deployment in the near future.

I’ll post updates when complete (maybe even the file paths if I get the time).

Till next time.

Microsoft Deployment Toolkit, how Microsoft almost got it right.

Anyone who is deploying Windows 7 to the Enterprise should already be familiar with Microsoft’s Deployment Toolkit (MDT).  It is a great tool and so much easier than what used to be around.  There are other alternatives, however if you are already running a Microsoft Server this is a free option.

Coming from a Mac background there is still much to be desired, but Microsoft has done a good job in getting closer to what can work.  Here are a few things that Microsoft could/should change to make using MDT more useful (and things for you to watch out for when using MDT).

  1. Copying workflows, you can’t.
    • The workflows have unique ID’s.  If you copy one you are just making a reference to the original.  Modify one of them and the other gets modified as well.  Create a new workflow and copy the Task Sequence if you want a new workflow to follow the original.
  2. Active Directory binding to OU group naming
    • The AD binding feature of MDT is a great tool.  However, without hacking the MDT you are limited to seeing only the full path of the OU you are putting the computer into.  Make sure the last OU is named something that you can easily identify.
  3. You can’t move the order of your Applications.
    • There are tools to re-organize your application packages once you’ve uploaded them, but nothing native to MDT.  Things change, orders should be able to be changed as well.  This feature makes it seem like the developers never used it to modify complex workflows.
  4. The OS specific options can not be altered without a separate deployment.
    • There are some options that are set for the entire deployment, and some that are set on the individual task sequence.  It would be so useful to be able to alter some of the deployment options based on Task Sequence selected, not the deployment share it resides on.

While these are just some of the annoyances of MDT, it does the job well enough to consider it, especially for it’s price.  It’s driver injection & easily modified application installation scripts make it a useful tool to for your IT toolbox.

Till next time.