├── README.md ├── Remove2011 └── dockutil /README.md: -------------------------------------------------------------------------------- 1 | # Remove2011 2 | Microsoft Office 2011 for Mac Removal Tool 3 | 4 | Purpose: Removes Office 2011 for Mac from a computer (without breaking Office 2016 for Mac)
5 | Usage: `Remove2011 [--Force] [--Help] [--KeepLync] [--SaveLicense]`
6 | Use `--Force` to bypass warnings and forcibly remove Office 2011 applications and data
7 | -------------------------------------------------------------------------------- /Remove2011: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #set -x 3 | 4 | TOOL_NAME="Microsoft Office 2011 for Mac Removal Tool" 5 | TOOL_VERSION="1.6" 6 | 7 | ## Copyright (c) 2019 Microsoft Corp. All rights reserved. 8 | ## Scripts are not supported under any Microsoft standard support program or service. The scripts are provided AS IS without warranty of any kind. 9 | ## Microsoft disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a 10 | ## particular purpose. The entire risk arising out of the use or performance of the scripts and documentation remains with you. In no event shall 11 | ## Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever 12 | ## (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary 13 | ## loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility 14 | ## of such damages. 15 | 16 | ## Set up logging 17 | # All stdout and sterr will go to the log file. Console alone can be accessed through >&3. For console and log use | tee /dev/fd/3 18 | SCRIPT_NAME=$(basename "$0") 19 | WORKING_FOLDER=$(dirname "$0") 20 | LOG_FILE="$TMPDIR""$SCRIPT_NAME.log" 21 | touch "$LOG_FILE" 22 | exec 3>&1 1>>${LOG_FILE} 2>&1 23 | 24 | ## Formatting support 25 | TEXT_RED='\033[0;31m' 26 | TEXT_YELLOW='\033[0;33m' 27 | TEXT_GREEN='\033[0;32m' 28 | TEXT_BLUE='\033[0;34m' 29 | TEXT_NORMAL='\033[0m' 30 | 31 | ## Initialize global variables 32 | FORCE_PERM=false 33 | PRESERVE_DATA=true 34 | APP_RUNNING=false 35 | KEEP_LYNC=false 36 | SAVE_LICENSE=false 37 | 38 | ## Path constants 39 | PATH_OFFICE2011="/Applications/Microsoft Office 2011" 40 | PATH_WORD2011="/Applications/Microsoft Office 2011/Microsoft Word.app" 41 | PATH_EXCEL2011="/Applications/Microsoft Office 2011/Microsoft Excel.app" 42 | PATH_PPT2011="/Applications/Microsoft Office 2011/Microsoft PowerPoint.app" 43 | PATH_OUTLOOK2011="/Applications/Microsoft Office 2011/Microsoft Outlook.app" 44 | PATH_LYNC2011="/Applications/Microsoft Lync.app" 45 | PATH_MAU="/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app" 46 | 47 | ## Functions 48 | function LogMessage { 49 | echo $(date) "$*" 50 | } 51 | 52 | function ConsoleMessage { 53 | echo "$*" >&3 54 | } 55 | 56 | function FormattedConsoleMessage { 57 | FUNCDENT="$1" 58 | FUNCTEXT="$2" 59 | printf "$FUNCDENT" "$FUNCTEXT" >&3 60 | } 61 | 62 | function AllMessage { 63 | echo $(date) "$*" 64 | echo "$*" >&3 65 | } 66 | 67 | function LogDevice { 68 | LogMessage "In function 'LogDevice'" 69 | system_profiler SPSoftwareDataType -detailLevel mini 70 | system_profiler SPHardwareDataType -detailLevel mini 71 | } 72 | 73 | function ShowUsage { 74 | LogMessage "In function 'ShowUsage'" 75 | ConsoleMessage "Usage: $SCRIPT_NAME [--Force] [--Help] [--KeepLync] [--SaveLicense]" 76 | ConsoleMessage "Use --Force to bypass warnings and forcibly remove Office 2011 applications and data" 77 | ConsoleMessage "" 78 | } 79 | 80 | function GetDestructivePerm { 81 | LogMessage "In function 'GetDestructivePerm'" 82 | if [ $FORCE_PERM = false ]; then 83 | LogMessage "Script is not running with force - asking user for permission to continue" 84 | ConsoleMessage "${TEXT_RED}WARNING: This procedure will remove application and data files.${TEXT_NORMAL}" 85 | ConsoleMessage "${TEXT_RED}Be sure to have a backup before continuing.${TEXT_NORMAL}" 86 | ConsoleMessage "Do you wish to continue? (y/n)" 87 | read -p "" "GOAHEAD" 88 | if [ "$GOAHEAD" == "y" ] || [ "$GOAHEAD" == "Y" ]; then 89 | LogMessage "Destructive permissions granted by user" 90 | return 91 | else 92 | LogMessage "Destructive permissions DENIED by user" 93 | ConsoleMessage "" 94 | exit 0 95 | fi 96 | fi 97 | } 98 | 99 | function GetDestructiveDataPerm { 100 | LogMessage "In function 'GetDestructiveDataPerm'" 101 | if [ $FORCE_PERM = false ]; then 102 | LogMessage "Script is not running with force - asking user for permission to remove data files" 103 | ConsoleMessage "${TEXT_RED}This tool can either preserve or remove Outlook data files.${TEXT_NORMAL}" 104 | ConsoleMessage "Do you wish to preserve Outlook data? (y/n)" 105 | read -p "" "GOAHEAD" 106 | if [ "$GOAHEAD" == "y" ] || [ "$GOAHEAD" == "Y" ]; then 107 | LogMessage "User chose to preserve Outlook data" 108 | PRESERVE_DATA=true 109 | else 110 | LogMessage "User chose to remove Outlook data" 111 | PRESERVE_DATA=false 112 | fi 113 | fi 114 | } 115 | 116 | function GetDestructiveLicensePerm { 117 | LogMessage "In function 'GetDestructiveLicensePerm'" 118 | if [ $FORCE_PERM = false ]; then 119 | LogMessage "Script is not running with force - asking user for permission to remove license file" 120 | if [ $SAVE_LICENSE = false ]; then 121 | LogMessage "SAVE_LICENSE is false - asking user if they want to remove it" 122 | ConsoleMessage "${TEXT_RED}This tool can either preserve or remove your product activation license.${TEXT_NORMAL}" 123 | ConsoleMessage "Do you wish to preserve the license? (y/n)" 124 | read -p "" "GOAHEAD" 125 | if [ "$GOAHEAD" == "y" ] || [ "$GOAHEAD" == "Y" ]; then 126 | LogMessage "User chose to preserve the license" 127 | SAVE_LICENSE=true 128 | else 129 | LogMessage "User chose to remove the license" 130 | SAVE_LICENSE=false 131 | fi 132 | fi 133 | fi 134 | } 135 | function GetSudo { 136 | LogMessage "In function 'GetSudo'" 137 | if [ "$EUID" != "0" ]; then 138 | LogMessage "Script is not running as root - asking user for admin password" 139 | sudo -p "Enter administrator password: " echo 140 | if [ $? -eq 0 ] ; then 141 | LogMessage "Admin password entered successfully" 142 | ConsoleMessage "" 143 | return 144 | else 145 | LogMessage "Admin password is INCORRECT" 146 | exit 1 147 | fi 148 | fi 149 | } 150 | 151 | function CheckRunning { 152 | FUNCPROC="$1" 153 | LogMessage "In function 'CheckRunning' with argument $FUNCPROC" 154 | local RUNNING_RESULT=$(ps ax | grep -v grep | grep "$FUNCPROC") 155 | if [ "${#RUNNING_RESULT}" -gt 0 ]; then 156 | LogMessage "$FUNCPROC is currently running" 157 | APP_RUNNING=true 158 | fi 159 | } 160 | 161 | function CheckRunning2011 { 162 | LogMessage "In function 'CheckRunning2011'" 163 | CheckRunning "$PATH_WORD2011" "Word 2011" 164 | CheckRunning "$PATH_EXCEL2011" "Excel 2011" 165 | CheckRunning "$PATH_PPT2011" "PowerPoint 2011" 166 | CheckRunning "$PATH_OUTLOOK2011" "Outlook 2011" 167 | if [ $KEEP_LYNC = false ]; then 168 | CheckRunning "$PATH_LYNC2011" "Lync 2011" 169 | fi 170 | } 171 | 172 | function Close2011 { 173 | LogMessage "In function 'Close2011'" 174 | if [ $FORCE_PERM = false ]; then 175 | LogMessage "Script is not running with force - asking user for permission to continue" 176 | GetForcePerms 177 | fi 178 | ForceQuit2011 179 | } 180 | 181 | function GetForcePerms { 182 | LogMessage "In function 'GetForcePerms'" 183 | ConsoleMessage "${TEXT_YELLOW}WARNING: Office applications are currently open and need to be closed.${TEXT_NORMAL}" 184 | ConsoleMessage "Do you want this program to forcibly close open applications? (y/n)" 185 | read -p "" "GOAHEAD" 186 | if [ "$GOAHEAD" == "y" ] || [ "$GOAHEAD" == "Y" ]; then 187 | LogMessage "User gave permission for the script to close running apps" 188 | FORCE_PERM=true 189 | ConsoleMessage "" 190 | else 191 | LogMessage "User DENIED permissions for the script to close running apps" 192 | ConsoleMessage "" 193 | exit 0 194 | fi 195 | } 196 | 197 | function ForceTerminate { 198 | FUNCPROC="$1" 199 | LogMessage "In function 'ForceTerminate' with argument $FUNCPROC" 200 | $(ps ax | grep -v grep | grep "$FUNCPROC" | cut -d' ' -f1 | xargs kill -9 2> /dev/null) 201 | } 202 | 203 | function ForceQuit2011 { 204 | LogMessage "In function 'ForceQuit2011'" 205 | FormattedConsoleMessage "%-55s" "Shutting down all Office 2011 applications" 206 | ForceTerminate "$PATH_WORD2011" "Word 2011" 207 | ForceTerminate "$PATH_EXCEL2011" "Excel 2011" 208 | ForceTerminate "$PATH_PPT2011" "PowerPoint 2011" 209 | ForceTerminate "$PATH_OUTLOOK2011" "Outlook 2011" 210 | if [ $KEEP_LYNC = false ]; then 211 | ForceTerminate "$PATH_LYNC2011" "Lync 2011" 212 | fi 213 | ConsoleMessage "${TEXT_GREEN}Success${TEXT_NORMAL}" 214 | } 215 | 216 | function RemoveComponent { 217 | FUNCPATH="$1" 218 | FUNCTEXT="$2" 219 | LogMessage "In function 'RemoveComponent with arguments $FUNCPATH and $FUNCTEXT'" 220 | FormattedConsoleMessage "%-55s" "Removing $FUNCTEXT" 221 | if [ -d "$FUNCPATH" ] || [ -e "$FUNCPATH" ] ; then 222 | LogMessage "Removing path $FUNCPATH" 223 | $(sudo rm -r -f "$FUNCPATH") 224 | else 225 | LogMessage "$FUNCPATH was not detected" 226 | ConsoleMessage "${TEXT_YELLOW}Not detected${TEXT_NORMAL}" 227 | return 228 | fi 229 | if [ -d "$FUNCPATH" ] || [ -e "$FUNCPATH" ] ; then 230 | LogMessage "Path $FUNCPATH still exists after deletion" 231 | ConsoleMessage "${TEXT_RED}Failed${TEXT_NORMAL}" 232 | else 233 | LogMessage "Path $FUNCPATH was successfully removed" 234 | ConsoleMessage "${TEXT_GREEN}Success${TEXT_NORMAL}" 235 | fi 236 | } 237 | 238 | function RemoveUserComponent { 239 | FUNCPATH="$1" 240 | FUNCTEXT="$2" 241 | LogMessage "In function 'RemoveUserComponent with arguments $FUNCPATH and $FUNCTEXT'" 242 | for u in `ls /Users`; do 243 | FULLPATH="/Users/$u/$FUNCPATH" 244 | $(sudo rm -r -f $FULLPATH) 245 | done 246 | } 247 | 248 | function PreserveUserComponent { 249 | FUNCPATH="$1" 250 | FUNCTEXT="$2" 251 | LogMessage "In function 'remove_PreserveComponent with arguments $FUNCPATH and $FUNCTEXT'" 252 | FormattedConsoleMessage "%-55s" "Preserving $FUNCTEXT" 253 | for u in `ls /Users`; do 254 | FULLPATH="/Users/$u/$FUNCPATH" 255 | if [ -d "$FULLPATH" ] || [ -e "$FULLPATH" ] ; then 256 | LogMessage "Renaming path $FULLPATH" 257 | $(sudo mv -fv "$FULLPATH" "$FULLPATH-Preserved") 258 | fi 259 | done 260 | ConsoleMessage "${TEXT_GREEN}Success${TEXT_NORMAL}" 261 | } 262 | 263 | function Remove2011Receipts { 264 | LogMessage "In function 'Remove2011Receipts'" 265 | FormattedConsoleMessage "%-55s" "Removing Package Receipts. This can take several minutes" 266 | RECEIPTCOUNT=0 267 | RemoveReceipt "com.microsoft.office.all.*" 268 | RemoveReceipt "com.microsoft.office.en.*" 269 | RemoveReceipt "com.microsoft.merp.*" 270 | RemoveReceipt "com.microsoft.mau.*" 271 | if (( $RECEIPTCOUNT > 0 )) ; then 272 | ConsoleMessage "${TEXT_GREEN}Success${TEXT_NORMAL}" 273 | else 274 | ConsoleMessage "${TEXT_YELLOW}Not detected${TEXT_NORMAL}" 275 | fi 276 | } 277 | 278 | function RemoveReceipt { 279 | FUNCPATH="$1" 280 | LogMessage "In function 'RemoveReceipt' with argument $FUNCPATH" 281 | PKGARRAY=($(pkgutil --pkgs=$FUNCPATH)) 282 | for p in "${PKGARRAY[@]}" 283 | do 284 | LogMessage "Forgetting package $p" 285 | sudo pkgutil --forget $p 286 | if [ $? -eq 0 ] ; then 287 | ((RECEIPTCOUNT++)) 288 | fi 289 | done 290 | } 291 | 292 | function Remove2011Preferences { 293 | LogMessage "In function 'Remove2011Preferences'" 294 | FormattedConsoleMessage "%-55s" "Removing Preferences" 295 | PREFCOUNT=0 296 | RemovePref "/Library/Preferences/com.microsoft.Word.plist" 297 | RemovePref "/Library/Preferences/com.microsoft.Excel.plist" 298 | RemovePref "/Library/Preferences/com.microsoft.Powerpoint.plist" 299 | RemovePref "/Library/Preferences/com.microsoft.Outlook.plist" 300 | RemovePref "/Library/Preferences/com.microsoft.outlook.databasedaemon.plist" 301 | RemovePref "/Library/Preferences/com.microsoft.DocumentConnection.plist" 302 | RemovePref "/Library/Preferences/com.microsoft.office.setupassistant.plist" 303 | RemoveUserPref "Library/Preferences/com.microsoft.Word.plist" 304 | RemoveUserPref "Library/Preferences/com.microsoft.Excel.plist" 305 | RemoveUserPref "Library/Preferences/com.microsoft.Powerpoint.plist" 306 | if [ $KEEP_LYNC = false ]; then 307 | RemoveUserPref "Library/Preferences/com.microsoft.Lync.plist" 308 | fi 309 | RemoveUserPref "Library/Preferences/com.microsoft.Outlook.plist" 310 | RemoveUserPref "Library/Preferences/com.microsoft.outlook.databasedaemon.plist" 311 | RemoveUserPref "Library/Preferences/com.microsoft.outlook.office_reminders.plist" 312 | RemoveUserPref "Library/Preferences/com.microsoft.DocumentConnection.plist" 313 | RemoveUserPref "Library/Preferences/com.microsoft.office.setupassistant.plist" 314 | RemoveUserPref "Library/Preferences/com.microsoft.office.plist" 315 | RemoveUserPref "Library/Preferences/com.microsoft.error_reporting.plist" 316 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.Word.*.plist" 317 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.Excel.*.plist" 318 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.Powerpoint.*.plist" 319 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.Outlook.*.plist" 320 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.outlook.databasedaemon.*.plist" 321 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.DocumentConnection.*.plist" 322 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.office.setupassistant.*.plist" 323 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.registrationDB.*.plist" 324 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.e0Q*.*.plist" 325 | RemoveUserPref "Library/Preferences/ByHost/com.microsoft.Office365.*.plist" 326 | if [ $KEEP_LYNC = false ]; then 327 | RemoveUserPref "Library/Preferences/ByHost/MicrosoftLyncRegistrationDB.*.plist" 328 | fi 329 | if (( $PREFCOUNT > 0 )); then 330 | ConsoleMessage "${TEXT_GREEN}Success${TEXT_NORMAL}" 331 | else 332 | ConsoleMessage "${TEXT_YELLOW}Not detected${TEXT_NORMAL}" 333 | fi 334 | } 335 | 336 | function RemovePref { 337 | FUNCPATH="$1" 338 | LogMessage "In function 'RemovePref' with argument $FUNCPATH" 339 | ls $FUNCPATH 340 | if [ $? -eq 0 ] ; then 341 | LogMessage "Found preference $FUNCPATH" 342 | $(sudo rm -f $FUNCPATH) 343 | if [ $? -eq 0 ] ; then 344 | LogMessage "Preference $FUNCPATH removed" 345 | ((PREFCOUNT++)) 346 | else 347 | LogMessage "Preference $FUNCPATH could NOT be removed" 348 | fi 349 | fi 350 | } 351 | 352 | function RemoveUserPref { 353 | FUNCPATH="$1" 354 | LogMessage "In function 'RemoveUserPref' with argument $FUNCPATH" 355 | for u in `ls /Users`; do 356 | FULLPATH="/Users/$u/$FUNCPATH" 357 | $(sudo rm -f $FULLPATH) 358 | ((PREFCOUNT++)) 359 | done 360 | } 361 | 362 | function CleanDock { 363 | LogMessage "In function 'CleanDock'" 364 | FormattedConsoleMessage "%-55s" "Cleaning icons in dock" 365 | if [ -e "$WORKING_FOLDER/dockutil" ]; then 366 | LogMessage "Found DockUtil tool" 367 | sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20Document%20Connection.app/" --no-restart 368 | sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20Word.app/" --no-restart 369 | sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20Excel.app/" --no-restart 370 | sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20PowerPoint.app/" --no-restart 371 | if [ $KEEP_LYNC = false ]; then 372 | sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20Lync.app/" --no-restart 373 | fi 374 | sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20Outlook.app/" 375 | LogMessage "Completed dock clean-up" 376 | ConsoleMessage "${TEXT_GREEN}Success${TEXT_NORMAL}" 377 | else 378 | ConsoleMessage "${TEXT_YELLOW}Not detected${TEXT_NORMAL}" 379 | fi 380 | } 381 | 382 | function RelaunchCFPrefs { 383 | LogMessage "In function 'RelaunchCFPrefs'" 384 | FormattedConsoleMessage "%-55s" "Restarting Preferences Daemon" 385 | sudo ps ax | grep -v grep | grep "cfprefsd" | cut -d' ' -f1 | xargs sudo kill -9 386 | if [ $? -eq 0 ] ; then 387 | LogMessage "Successfully terminated all preferences daemons" 388 | ConsoleMessage "${TEXT_GREEN}Success${TEXT_NORMAL}" 389 | else 390 | LogMessage "FAILED to terminate all preferences daemons" 391 | ConsoleMessage "${TEXT_RED}Failed${TEXT_NORMAL}" 392 | fi 393 | } 394 | 395 | function MainLoop { 396 | LogMessage "In function 'MainLoop'" 397 | # Show warning about destructive behavior of the script and ask for permission to continue 398 | GetDestructivePerm 399 | GetDestructiveDataPerm 400 | GetDestructiveLicensePerm 401 | # If appropriate, elevate permissions so the script can perform all actions 402 | GetSudo 403 | # Check to see if any of the 2011 apps are currently open 404 | CheckRunning2011 405 | if [ $APP_RUNNING = true ]; then 406 | LogMessage "One of more 2011 apps are running" 407 | Close2011 408 | fi 409 | # Remove Office 2011 apps 410 | RemoveComponent "$PATH_OFFICE2011" "Office 2011 Applications" 411 | if [ $KEEP_LYNC = false ]; then 412 | RemoveComponent "$PATH_LYNC2011" "Lync" 413 | fi 414 | 415 | # Remove Office 2011 helpers 416 | RemoveComponent "/Library/LaunchDaemons/com.microsoft.office.licensing.helper.plist" "Launch Daemon: Licensing Helper" 417 | RemoveComponent "/Library/PrivilegedHelperTools/com.microsoft.office.licensing.helper" "Helper Tools: Licensing Helper" 418 | # Remove Office 2011 fonts 419 | RemoveComponent "/Library/Fonts/Microsoft" "Office Fonts" 420 | # Remove Office 2011 license 421 | if [ $SAVE_LICENSE = false ]; then 422 | LogMessage "SAVE_LICENSE is false - removing license file" 423 | RemoveComponent "/Library/Preferences/com.microsoft.office.licensing.plist" "Product License" 424 | fi 425 | # Remove Office 2011 application support 426 | RemoveComponent "/Library/Application Support/Microsoft/MERP2.0" "Error Reporting" 427 | RemoveComponent "/Library/Application Support/Microsoft/HV1.0" "Help Viewer" 428 | RemoveComponent "/Library/Application Support/Microsoft/Office Converter Support" "Converter Support" 429 | RemoveComponent "/Library/Application Support/Microsoft/Silverlight" "Silverlight" 430 | RemoveComponent "/Applications/Remote Desktop Connection.app" "Remote Desktop Connection" 431 | RemoveUserComponent "Library/Application Support/Microsoft/Office" "Application Support" 432 | # Remove Office 2011 caches 433 | RemoveUserComponent "Library/Caches/com.microsoft.browserfont.cache" "Browser Font Cache" 434 | RemoveUserComponent "Library/Caches/com.microsoft.office.setupassistant" "Setup Assistant Cache" 435 | RemoveUserComponent "Library/Caches/Microsoft/Office" "Office Cache" 436 | RemoveUserComponent "Library/Caches/Outlook" "Outlook Identity Cache" 437 | RemoveUserComponent "Library/Caches/com.microsoft.Outlook" "Outlook Cache" 438 | # Remove Office 2011 preferences 439 | Remove2011Preferences 440 | # Remove or rename Outlook 2011 identities and databases 441 | if [ $PRESERVE_DATA = false ]; then 442 | RemoveUserComponent "Documents/Microsoft User Data/Office 2011 Identities" "Outlook Identities and Databases" 443 | RemoveUserComponent "Documents/Microsoft User Data/Saved Attachments" "Outlook Saved Attachments" 444 | RemoveUserComponent "Documents/Microsoft User Data/Outlook Sound Sets" "Outlook Sound Sets" 445 | else 446 | PreserveUserComponent "Documents/Microsoft User Data/Office 2011 Identities" "Outlook Identities and Databases" 447 | PreserveUserComponent "Documents/Microsoft User Data/Saved Attachments" "Outlook Saved Attachments" 448 | PreserveUserComponent "Documents/Microsoft User Data/Outlook Sound Sets" "Outlook Sound Sets" 449 | fi 450 | # Remove Office 2011 package receipts 451 | Remove2011Receipts 452 | # Clean up icons on the dock 453 | CleanDock 454 | # Restart cfprefs 455 | RelaunchCFPrefs 456 | } 457 | 458 | ## Main 459 | LogMessage "Starting $SCRIPT_NAME" 460 | AllMessage "${TEXT_BLUE}=== $TOOL_NAME $TOOL_VERSION ===${TEXT_NORMAL}" 461 | LogDevice 462 | 463 | # Evaluate command-line arguments 464 | if [[ $# = 0 ]]; then 465 | LogMessage "No command-line arguments passed, going into interactive mode" 466 | MainLoop 467 | else 468 | LogMessage "Command-line arguments passed, attempting to parse" 469 | while [[ $# > 0 ]] 470 | do 471 | key="$1" 472 | LogMessage "Argument: $key" 473 | case "$key" in 474 | --Help|-h|--help) 475 | ShowUsage 476 | exit 0 477 | shift # past argument 478 | ;; 479 | --Force|-f|--force) 480 | LogMessage "Force mode set to TRUE" 481 | FORCE_PERM=true 482 | shift # past argument 483 | ;; 484 | --KeepLync|-k|--keeplync) 485 | LogMessage "Keep Lync set to TRUE" 486 | KEEP_LYNC=true 487 | shift # past argument 488 | ;; 489 | --SaveLicense|-s|--savelicense) 490 | LogMessage "SaveLicense set to TRUE" 491 | SAVE_LICENSE=true 492 | shift # past argument 493 | ;; 494 | *) 495 | ShowUsage 496 | echo "Ignoring unrecognized argument: $key" 497 | ;; 498 | esac 499 | shift # past argument or value 500 | done 501 | MainLoop 502 | fi 503 | 504 | ConsoleMessage "" 505 | ConsoleMessage "All events and errors were logged to $LOG_FILE" 506 | ConsoleMessage "" 507 | LogMessage "Exiting script" 508 | exit 0 509 | -------------------------------------------------------------------------------- /dockutil: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # This file is based on or incorporates material from the projects listed below (Third Party IP). The original copyright notice and the license under 4 | # which Microsoft received such Third Party IP, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft 5 | # licenses the Third Party IP to you under the licensing terms for the Microsoft product. Microsoft reserves all other rights not expressly granted 6 | # under this agreement, whether by implication, estoppel or otherwise. 7 | 8 | # DOCKUTIL 9 | # Copyright 2008 Kyle Crawford 10 | 11 | # Provided for Informational Purposes Only 12 | 13 | # Licensed under the Apache License, Version 2.0 (the "License"); 14 | # you may not use this file except in compliance with the License. 15 | # You may obtain a copy of the License at 16 | # 17 | # http://www.apache.org/licenses/LICENSE-2.0 18 | 19 | # THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY 20 | # IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. 21 | 22 | # See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. 23 | 24 | # Send bug reports and comments to kcrwfrd at gmail 25 | 26 | # Possible future enhancements 27 | # tie in with application identifier codes for locating apps and replacing them in the dock with newer versions? 28 | 29 | import sys, plistlib, subprocess, os, getopt, re, pipes, tempfile, pwd 30 | import platform 31 | 32 | 33 | # default verbose printing to off 34 | verbose = False 35 | version = '2.0.2' 36 | 37 | def usage(e=None): 38 | """Displays usage information and error if one occurred""" 39 | 40 | print """usage: %(progname)s -h 41 | usage: %(progname)s --add | [--label