Skip to content

Instantly share code, notes, and snippets.

View macmule's full-sized avatar

macmule macmule

View GitHub Profile
use framework "Foundation"
set fileManager to current application's NSFileManager's defaultManager()
set volname to (fileManager's displayNameAtPath:"/") as text
if ADGroups contains "<insert_printer_name>" then
if installedPrinters does not contain "<insert_printer_name>" then
try
do shell script "/usr/sbin/lpadmin -p <insert_printer_name> -E -v lpd://<insert_printer_name>.macmule.com -P /Library/Printers/PPDs/Contents/Resources/en.lproj/Canon\\ iR-ADV\\ C5200s-B2\\ PS\\ V1.0 -o printer-is-shared=false -o EFDuplex=False"
on error
do shell script "/usr/sbin/lpadmin -p <insert_printer_name> -E -v lpd://<insert_printer_name>.macmule.com -P /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/Resources/Generic.ppd -o printer-is-shared=false"
end try
end if
end if
diskutil coreStorage
Usage: diskutil [quiet] coreStorage|CS <verb> <options>,
where <verb> is as follows:
list (Show status of CoreStorage volumes)
info[rmation] (Get CoreStorage information by UUID or disk)
convert (Convert a volume into a CoreStorage volume)
revert (Revert a CoreStorage volume to its native type)
create (Create a new CoreStorage logical volume group)
delete (Delete a CoreStorage logical volume group)
#!/bin/sh
# Echo target drive
echo "Target drive is: $1"
# Delete the CoreStorage volume
/usr/sbin/diskutil coreStorage deleteVolume "$1"
echo "CoreStorage volume $1 deleted"
# Get the UUID of the CoreStorage Logical Volume Group
#!/bin/sh
# Get the UUID of the CoreStorage Logical Volume Group
csLVGUUID=`/usr/sbin/diskutil corestorage list | awk '/Logical Volume Group/{print $NF}'`
echo "We are going to delete the Logical Volume Group with UUID: $csLVGUUID..."
# Delete the CoreStorage Volume
/usr/sbin/diskutil corestorage delete "$csLVGUUID"
echo "Deleted the Logical Volume Group $csLVGUUID..."
<?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.macmule.corestoragerevert</string>
<key>Program</key>
<string>/Applications/CoreStorage Revert.app/Contents/MacOS/applet</string>
<key>RunAtLoad</key>
<true/>
#!/bin/sh
## postinstall
targetVolume=$3
## Delete the AutoCasperNBI installed Casper Imaging launch agent
rm -rf "$3"/Library/LaunchAgents/com.AutoCasperNBI.CasperImaging.plist
## If the launch agent exists after the above, error
if [ -f "$3"/Library/LaunchAgents/com.AutoCasperNBI.CasperImaging.plist ];
-- Get the name Volume Name of the Macs CoreStorage volume.
set csVolume to do shell script "diskutil cs list | awk '/Volume Name:/{out=$3; for(i=4;i<=NF;i++){out=out\" \"$i}; print out}'"
-- If the above command come back with a Volume Name.
if csVolume is not "" then
-- Set this app to the front
tell application "System Events" to set frontmost of process "CoreStorage Revert" to true
-- Advise that volume needs to be reverted, offering option to skip if wanted
#!/bin/bash
####################################################################################################
#
# License: https://macmule.com/license/
#
###################################################################################################
#
# DEFINE VARIABLES & READ IN PARAMETERS
#
####################################################################################################
#!/bin/sh
####################################################################################################
#
# License: https://macmule.com/license/
#
####################################################################################################
###
# Get the Active Directory Node Name
###