mirror of
https://github.com/NohamR/Office-Reset.git
synced 2026-05-24 19:59:35 +00:00
Add Office Reset scripts and README
This commit is contained in:
35
scripts/Office_OneNote_Remove_Data.sh
Executable file
35
scripts/Office_OneNote_Remove_Data.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/zsh
|
||||
|
||||
echo "Office-Reset: Starting postinstall for Remove_OneNote_Data"
|
||||
autoload is-at-least
|
||||
|
||||
GetLoggedInUser() {
|
||||
LOGGEDIN=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/&&!/loginwindow/{print $3}')
|
||||
if [ "$LOGGEDIN" = "" ]; then
|
||||
echo "$USER"
|
||||
else
|
||||
echo "$LOGGEDIN"
|
||||
fi
|
||||
}
|
||||
|
||||
SetHomeFolder() {
|
||||
HOME=$(dscl . read /Users/"$1" NFSHomeDirectory | cut -d ':' -f2 | cut -d ' ' -f2)
|
||||
if [ "$HOME" = "" ]; then
|
||||
if [ -d "/Users/$1" ]; then
|
||||
HOME="/Users/$1"
|
||||
else
|
||||
HOME=$(eval echo "~$1")
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
## Main
|
||||
LoggedInUser=$(GetLoggedInUser)
|
||||
SetHomeFolder "$LoggedInUser"
|
||||
echo "Office-Reset: Running as: $LoggedInUser; Home Folder: $HOME"
|
||||
|
||||
/usr/bin/pkill -9 'Microsoft OneNote'
|
||||
|
||||
/bin/rm -rf $HOME/Library/Containers/com.microsoft.onenote.mac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user