In my previous post about dummy receipts, I talked about how to use an empty hidden file to identify which configuration a machine has been imaged with. Today, I’m going to talk about how to use a plist to identify additional information about a machine’s configuration. The K-12 school I developed the last solution for asked for a way to determine when a machine was imaged. This is the solution I came up with.
This time, in our post imaging script, we’re going to create a plist that includes the imaging name. We’ll do this with the following command:
defaults write /Library/Preferences/com.pretendco.image.plist name “Student Image”
This command will create the plist and add the name of the image to the plist. Next, we’ll add the date with the following lines:
defaults write /Library/Preferences/com.pretendco.image.plist date $currentDate
This dynamically gets the current date and adds it to the same plist.
Next we need to create extension attributes to look for these values. They should both be populate by a script, and look for a string as a returned value.
echo “<result>`defaults read /Library/Preferences/com.pretendco.image.plist name`</result>”
echo “<result>`defaults read /Library/Preferences/com.pretendco.image.plist date`</result>”
This could be taken further, adding values for things like build number, image time, and anything else you could think of. Your imagination is the limit.
You can grab an example script and extension attributes over on my Github page.