Guest User

Microsoft_Office_License_Removal_1.5.pkg

a guest
Aug 20th, 2018
124
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. /usr/bin/logger "Starting Office for Mac License Removal 1.5"
  4. curl https://officecdn-microsoft-com.akamaized.net/pr/C1297A47-86C4-4C1F-97FA-950631F94777/OfficeMac/LRT-Start.txt
  5. PERPLICENSE="/Library/Preferences/com.microsoft.office.licensingV2.plist"
  6. PERPLICENSEBACKUP="/Library/Preferences/com.microsoft.office.licensingV2.Backup"
  7. O365SUBMAIN="$HOME/Library/Group Containers/UBF8T346G9.Office/com.microsoft.Office365.plist"
  8. O365SUBBAK1="$HOME/Library/Group Containers/UBF8T346G9.Office/com.microsoft.e0E2OUQxNUY1LTAxOUQtNDQwNS04QkJELTAxQTI5M0JBOTk4O.plist"
  9. O365SUBBAK2="$HOME/Library/Group Containers/UBF8T346G9.Office/e0E2OUQxNUY1LTAxOUQtNDQwNS04QkJELTAxQTI5M0JBOTk4O"
  10. O365SUBMAINB="$HOME/Library/Group Containers/UBF8T346G9.Office/com.microsoft.Office365V2.plist"
  11. O365SUBBAK1B="$HOME/Library/Group Containers/UBF8T346G9.Office/com.microsoft.O4kTOBJ0M5ITQxATLEJkQ40SNwQDNtQUOxATL1YUNxQUO2E0e.plist"
  12. O365SUBBAK2B="$HOME/Library/Group Containers/UBF8T346G9.Office/O4kTOBJ0M5ITQxATLEJkQ40SNwQDNtQUOxATL1YUNxQUO2E0e"
  13.  
  14. # Remove the Perpetual/Volume License from the computer
  15. if [ -f "$PERPLICENSE" ]
  16. then
  17.     /usr/bin/logger "Detected $PERPLICENSE file"
  18.     /usr/bin/sudo mv -f "$PERPLICENSE" "$PERPLICENSEBACKUP"
  19.     /usr/bin/logger "Removed $PERPLICENSE file"
  20.     curl https://officecdn-microsoft-com.akamaized.net/pr/C1297A47-86C4-4C1F-97FA-950631F94777/OfficeMac/LRT-VL.txt
  21. else
  22.     /usr/bin/logger "Did NOT detect $PERPLICENSE file"
  23. fi
  24.  
  25. if ! [[ $COMMAND_LINE_INSTALL && $COMMAND_LINE_INSTALL != 0 ]]
  26. then
  27.     # Remove the Office 365 Subscription License if we're running from the installer UI
  28.     if [ -f "$O365SUBMAIN" ] || [ -f "$O365SUBBAK1" ] || [ -f "$O365SUBBAK2" ] || [ -f "$O365SUBMAINB" ] || [ -f "$O365SUBBAK1B" ] || [ -f "$O365SUBBAK2B" ]
  29.     then
  30.         /usr/bin/logger "Detected Office 365 Subscription License file"
  31.         /usr/bin/sudo -u $USER rm -f "$O365SUBMAIN"
  32.         /usr/bin/sudo -u $USER rm -f "$O365SUBBAK1"
  33.         /usr/bin/sudo -u $USER rm -f "$O365SUBBAK2"
  34.         /usr/bin/sudo -u $USER rm -f "$O365SUBMAINB"
  35.         /usr/bin/sudo -u $USER rm -f "$O365SUBBAK1B"
  36.         /usr/bin/sudo -u $USER rm -f "$O365SUBBAK2B"
  37.         /usr/bin/logger "Removed all Office 365 Subscription License files"
  38.         curl https://officecdn-microsoft-com.akamaized.net/pr/C1297A47-86C4-4C1F-97FA-950631F94777/OfficeMac/LRT-Sub.txt
  39.     else
  40.         /usr/bin/logger "Did NOT detect Office 365 Subscription License file"
  41.     fi
  42. fi
  43.  
  44. # Remove any keychain entries for Office
  45. /usr/bin/sudo -u $USER /usr/bin/security delete-internet-password -s 'msoCredentialSchemeADAL'
  46. /usr/bin/sudo -u $USER /usr/bin/security delete-internet-password -s 'msoCredentialSchemeLiveId'
  47. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -l 'Microsoft Office Identities Settings 2'
  48. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -l 'Microsoft Office Identities Settings 3'
  49. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -l 'Microsoft Office Identities Cache 2'
  50. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -l 'Microsoft Office Identities Cache 3'
  51. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -l 'Microsoft Office Ticket Cache'
  52. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -l 'com.microsoft.adalcache'
  53. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -l 'MicrosoftOfficeRMSCredential'
  54. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -l 'MSProtection.framework.service'
  55. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -g 'MSOpenTech.ADAL.1'
  56. /usr/bin/sudo -u $USER /usr/bin/security delete-generic-password -g 'MSOpenTech.ADAL.1'
  57.  
  58. # Remove the Belongs To information
  59. /usr/bin/sudo -u $USER /usr/bin/defaults delete com.microsoft.office OfficeActivationEmailAddress
  60.  
  61. # Reset the first run experience for each licensed app
  62. /usr/bin/sudo -u $USER /usr/bin/defaults write com.microsoft.Word kSubUIAppCompletedFirstRunSetup1507 -bool FALSE
  63. /usr/bin/sudo -u $USER /usr/bin/defaults write com.microsoft.Excel kSubUIAppCompletedFirstRunSetup1507 -bool FALSE
  64. /usr/bin/sudo -u $USER /usr/bin/defaults write com.microsoft.Powerpoint kSubUIAppCompletedFirstRunSetup1507 -bool FALSE
  65. /usr/bin/sudo -u $USER /usr/bin/defaults write com.microsoft.Outlook kSubUIAppCompletedFirstRunSetup1507 -bool FALSE
  66. /usr/bin/sudo -u $USER /usr/bin/defaults write com.microsoft.onenote.mac kSubUIAppCompletedFirstRunSetup1507 -bool FALSE
  67. /usr/bin/sudo -u $USER /usr/bin/defaults write com.microsoft.Outlook FirstRunExperienceCompletedO15 -bool FALSE
  68. /usr/bin/logger "Set apps back to first run state"
  69.  
  70. # Restart the CFPreferences daemon to ensure that all caches are flushed
  71. /usr/bin/sudo /usr/bin/killall cfprefsd
  72. /usr/bin/logger "Terminated all instances of CFPrefsd"
  73.  
  74. /usr/bin/logger "Completed Office for Mac License Removal 1.5"
  75. curl https://officecdn-microsoft-com.akamaized.net/pr/C1297A47-86C4-4C1F-97FA-950631F94777/OfficeMac/LRT-End.txt
  76.  
  77. exit 0
RAW Paste Data