NetBoot useful management

tkimpton
Valued Contributor II

Sometimes after Casper Imaging I get a connection error 8442 and I have to
click ok, machine reboots and has imaged ok. I have spoke to jamf support
and cannot get to the bottom of the problem.

Instead I have got a work around.

Launch Daemon created with Lingon installed on the NetBoot Image

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict> <key>Label</key> <string>com.jamf.imaging.fix.Launchd</string> <key>ProgramArguments</key> <array> <string>sh</string> <string>/Library/Management/Scripts/Imaging_Reboot_Fix.sh</string> </array> <key>RunAtLoad</key> <true/> <key>WatchPaths</key> <array> <string>private/var/log/jamf.log</string> </array>
</dict>
</plist>

Script installed on the NetBoot Image

#!/bin/bash

# Check to see if Blessing is shown in the jamf.log
if
grep 'Blessing' /private/var/log/jamf.log
then

# Pause 5 minutes
sleep 300

# Reboot
shutdown -r now

else
# If Blessing is not found then do nothing
echo "Not Blessing the target disk yet!"
fi

When the machine gets this error it pauses for 5 minutes then reboots :)

Lock the NetBoot Image so that users can't cancel or screw with anything

Another problem I had was a user screwed up the imaging process on a
machine.

This solution as long as

  1. you have the automatic login set screen saver turned off
  2. change the Engine Defaults to 0 in /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/Engine Defaults.plist
  3. Have Casper Imaging open at login
  4. have the jss preferences set.

As soon as Casper Imaging starts this application is launched
/System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents
/Support/LockScreen.app

Casper Imaging is shown over the top so you can view the progress but the
keyboard and mouse are disabled because of the LockScreen app running
preventing users ruining the imaging.

Launch Daemon created with Lingon installed on the NetBoot Image

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict> <key>KeepAlive</key> <false/> <key>Label</key> <string>com.imaging.lockscreen.Launchd</string> <key>ProgramArguments</key> <array> <string>sh</string> <string>/Library/Management/Scripts/Imaging_Lock.sh</string> </array> <key>RunAtLoad</key> <true/> <key>WatchPaths</key> <array> <string>private/var/log/system.log</string> </array>
</dict>
</plist>

Script installed on the NetBoot Image

#!/bin/bash

# Check to see if Imaging has started
if
grep 'executing /usr/sbin/diskutil' /private/var/log/system.log
then

# Lock the Screen
open /System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents
/Support/LockScreen.app

else
# If not Imaging don't do anything
echo "Not Imaging yet!"
fi

Thanks Will for telling me about the LockScreen.app :)

Hope this helps others

Tim Kimpton
Systems Engineer
E: Tim.Kimpton at rufusleonard.com
D: +44 (0)20 7956 3014
W: http://www.rufusleonard.com
F: facebook.com/rufusleonarduk
T: twitter.com/rufusleonard

Rufus Leonard limited is a company registered in England and Wales with
company number 3348509. Vat number: 691308528

![external image link](attachments/9c31e36ae9b54577a1b195ec98730cd9)

1 REPLY 1

tkimpton
Valued Contributor II

Sometimes after Casper Imaging I get a connection error 8442 and I have to
click ok, machine reboots and has imaged ok. I have spoke to jamf support
and cannot get to the bottom of the problem.

Instead I have got a work around.

Launch Daemon created with Lingon installed on the NetBoot Image

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict> <key>Label</key> <string>com.jamf.imaging.fix.Launchd</string> <key>ProgramArguments</key> <array> <string>sh</string> <string>/Library/Management/Scripts/Imaging_Reboot_Fix.sh</string> </array> <key>RunAtLoad</key> <true/> <key>WatchPaths</key> <array> <string>private/var/log/jamf.log</string> </array>
</dict>
</plist>

Script installed on the NetBoot Image

#!/bin/bash

# Check to see if Blessing is shown in the jamf.log
if
grep 'Blessing' /private/var/log/jamf.log
then

# Pause 5 minutes
sleep 300

# Reboot
shutdown -r now

else
# If Blessing is not found then do nothing
echo "Not Blessing the target disk yet!"
fi

When the machine gets this error it pauses for 5 minutes then reboots :)

Lock the NetBoot Image so that users can't cancel or screw with anything

Another problem I had was a user screwed up the imaging process on a
machine.

This solution as long as

  1. you have the automatic login set screen saver turned off
  2. change the Engine Defaults to 0 in /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/Engine Defaults.plist
  3. Have Casper Imaging open at login
  4. have the jss preferences set.

As soon as Casper Imaging starts this application is launched
/System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents
/Support/LockScreen.app

Casper Imaging is shown over the top so you can view the progress but the
keyboard and mouse are disabled because of the LockScreen app running
preventing users ruining the imaging.

Launch Daemon created with Lingon installed on the NetBoot Image

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict> <key>KeepAlive</key> <false/> <key>Label</key> <string>com.imaging.lockscreen.Launchd</string> <key>ProgramArguments</key> <array> <string>sh</string> <string>/Library/Management/Scripts/Imaging_Lock.sh</string> </array> <key>RunAtLoad</key> <true/> <key>WatchPaths</key> <array> <string>private/var/log/system.log</string> </array>
</dict>
</plist>

Script installed on the NetBoot Image

#!/bin/bash

# Check to see if Imaging has started
if
grep 'executing /usr/sbin/diskutil' /private/var/log/system.log
then

# Lock the Screen
open /System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents
/Support/LockScreen.app

else
# If not Imaging don't do anything
echo "Not Imaging yet!"
fi

Thanks Will for telling me about the LockScreen.app :)

Hope this helps others

Tim Kimpton
Systems Engineer
E: Tim.Kimpton at rufusleonard.com
D: +44 (0)20 7956 3014
W: http://www.rufusleonard.com
F: facebook.com/rufusleonarduk
T: twitter.com/rufusleonard

Rufus Leonard limited is a company registered in England and Wales with
company number 3348509. Vat number: 691308528

![external image link](attachments/5ea5f85bb9264a5884fcbdb378112bf3)