Open Terminal and run:
sudo mkdir -p /usr/local/bin
cat <<'EOF' | sudo tee /usr/local/bin/office-reset.sh >/dev/null
#!/bin/bash
# Reset Microsoft Office activation & cached identities for the current user
# Quit Office apps
/usr/bin/pkill -f "Microsoft"
# Remove cached Office data
/bin/rm -rf "$HOME/Library/Group Containers/UBF8T346G9.Office/"*
/bin/rm -rf "$HOME/Library/Containers/com.microsoft."*
# Clean Keychain tokens (ignore errors if not present)
/usr/bin/security delete-generic-password -l "Microsoft Office Identities Cache 2" "$HOME/Library/Keychains/login.keychain-db" 2>/dev/null
/usr/bin/security delete-generic-password -l "Microsoft Office Identities Settings 2" "$HOME/Library/Keychains/login.keychain-db" 2>/dev/null
/usr/bin/security delete-generic-password -s "ADAL" "$HOME/Library/Keychains/login.keychain-db" 2>/dev/null
/usr/bin/security delete-generic-password -s "MSOID" "$HOME/Library/Keychains/login.keychain-db" 2>/dev/null
# Nice-to-have: clear app saved state so Word doesn't re-open old windows
/bin/rm -rf "$HOME/Library/Saved Application State/com.microsoft."*.savedState
exit 0
EOF
sudo chmod 755 /usr/local/bin/office-reset.sh
cat <<'EOF' | sudo tee /Library/LaunchAgents/au.nlsc.office.reset.plist >/dev/null
<?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>au.nlsc.office.reset</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/office-reset.sh</string>
</array>
<key>RunAtLoad</key><true/>
<key>StandardOutPath</key><string>/tmp/office-reset.out</string>
<key>StandardErrorPath</key><string>/tmp/office-reset.err</string>
</dict>
</plist>
EOF
sudo chown root:wheel /Library/LaunchAgents/au.nlsc.office.reset.plist
sudo chmod 644 /Library/LaunchAgents/au.nlsc.office.reset.plist
Now log out and back in
************************-------------------**************************
Open Terminal and run:
sudo mkdir -p /usr/local/bin
cat <<'EOF' | sudo tee /usr/local/bin/office-reset.sh >/dev/null
#!/bin/bash
# Reset Microsoft Office activation & cached identities for the current user
# Quit Office apps
/usr/bin/pkill -f "Microsoft"
# Remove cached Office data
/bin/rm -rf "$HOME/Library/Group Containers/UBF8T346G9.Office/"*
/bin/rm -rf "$HOME/Library/Containers/com.microsoft."*
# Clean Keychain tokens (ignore errors if not present)
/usr/bin/security delete-generic-password -l "Microsoft Office Identities Cache 2" "$HOME/Library/Keychains/login.keychain-db" 2>/dev/null
/usr/bin/security delete-generic-password -l "Microsoft Office Identities Settings 2" "$HOME/Library/Keychains/login.keychain-db" 2>/dev/null
/usr/bin/security delete-generic-password -s "ADAL" "$HOME/Library/Keychains/login.keychain-db" 2>/dev/null
/usr/bin/security delete-generic-password -s "MSOID" "$HOME/Library/Keychains/login.keychain-db" 2>/dev/null
# Clear app saved state so Word/Excel don’t reopen windows
/bin/rm -rf "$HOME/Library/Saved Application State/com.microsoft."*.savedState
exit 0
EOF
sudo chmod 755 /usr/local/bin/office-reset.sh
cat <<'EOF' | sudo tee /Library/LaunchAgents/au.nlsc.office.reset.plist >/dev/null
<?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>au.nlsc.office.reset</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/office-reset.sh</string>
</array>
<key>RunAtLoad</key><true/>
<key>StandardOutPath</key><string>/tmp/office-reset.out</string>
<key>StandardErrorPath</key><string>/tmp/office-reset.err</string>
</dict>
</plist>
EOF
sudo chown root:wheel /Library/LaunchAgents/au.nlsc.office.reset.plist
sudo chmod 644 /Library/LaunchAgents/au.nlsc.office.reset.plist
***************************-------------------*****************************
pkill "Microsoft" && rm -rf ~/Library/Group\ Containers/UBF8T346G9.Office/* ~/Library/Containers/com.microsoft.* && security delete-generic-password -l "Microsoft Office Identities Cache 2" ~/Library/Keychains/login.keychain-db 2>/dev/null && security delete-generic-password -l "Microsoft Office Identities Settings 2"~/Library/Keychains/login.keychain-db 2>/dev/null && security delete-generic-password -s "ADAL"~/Library/Keychains/login.keychain-db 2>/dev/null && security delete-generic-password -s "MSOID"~/Library/Keychains/login.keychain-db 2>/dev/null
*********************************-------------------************************************
rm -rf ~/Library/Group\ Containers/UBF8T346G9.Office/*
rm -rf ~/Library/Containers/com.microsoft.Word
rm -rf ~/Library/Containers/com.microsoft.Excel
rm -rf ~/Library/Containers/com.microsoft.Powerpoint
rm -rf ~/Library/Containers/com.microsoft.onenote.mac
*********************************-------------------************************************