Tool: Get the path to an Active Directory user home

automator_iconWhen you need to look up the path to an Active Directory user’s home directory, there are a few ways to get the information:

That last bullet point is the most convenient way, particularly because I’m about to tell you how to do it. We’ll use Automator to create a Service that uses AppleScript to get the home directory location of a username via a dscl query, and show the path in a dialog box in both Mac and Windows-friendly formats. As a bonus, we’ll let either of the paths be copied to the clipboard for easy pasting.

Before you start, I should note that this will only work on Macs that meet the following requirements:

  • running Mac OS 10.6 or later
  • bound to Active Directory

Sound good? Let’s begin.

Note: If you want to skip the tutorial, you can download the completed Automator service here, unzip it, and drop it into your ~/Library/Services folder. To use it, right-click on a username – it has to be showing in a Mac app somewhere as selectable text – then select Get AD Home from the pop-up menu or its Services submenu. Continue reading

New Tool: AD Password Monitor

icon

A fellow Mac admin has improved upon my solution to Active Directory password expiration management and has made his project available on Google Code. Password Monitor is an app that lives in your menu bar and unobtrusively displays the number of days remaining until your AD password expires.

pmon

Anyone who is either already using one of my scripts or widget or is just looking into a way to solve the AD password expiration problem should definitely give this a look. One key difference with this solution is that you must set the expiration age of AD passwords manually. Since this information is easy to obtain from your AD admin, it should not be an issue. Here’s what the preferences window looks like.

prefs

Keep in mind that the project is in its early stages, but it is quite useable now.

UPDATE: The current version is incompatible with Snow Leopard. The bug has already been reported.

shotshadows – Quick Script to Enable or Disable Screenshot Shadows

If you’ve taken screenshots of windows in Tiger and Leopard using the command-shift-4+space trick, you’ll have noticed that Leopard will include the window’s (rather large) drop shadows in the resulting image. Depending on your point of view this can be good, bad, or a mixed blessing. I’m in the latter camp. They can be nice for blog posts, but if you’re creating documentation, for example, they can take up precious space on the page.

Using this hint as a starting point, I wrote the following bash script to make the process of disabling and enabling those shadows quick and painless:

#!/bin/bash
usage () {
/bin/echo "Usage: shotshadows [off|on]"
exit 1
}
if [ $# == 1 ]; then
if [ $1 == "off" ]; then
/bin/echo "Disabling drop shadows in screenshots and restarting SystemUIServer"
/usr/bin/defaults write com.apple.screencapture disable-shadow -bool true
/usr/bin/killall SystemUIServer
elif [ $1 == "on" ]; then
/bin/echo "Enabling drop shadows in screenshots and restarting SystemUIServer"
/usr/bin/defaults delete com.apple.screencapture disable-shadow
/usr/bin/killall SystemUIServer
else
usage
fi
else
usage
fi

view raw
shotshadows.sh
hosted with ❤ by GitHub

Save this script as shotshadows — or download it here — make it executable, and drop it somewhere in your path. (I use /usr/local/bin.) Now you can turn screenshot shadows on and off with the simple terminal commands shotshadows on and shotshadows off. The change takes effect instantly.