Created
October 23, 2022 10:57
-
-
Save colorenz/381bcd4d5c98da84c4383489e6717b88 to your computer and use it in GitHub Desktop.
Extenstion Attribute to check if a User Desktop or Documents Folder are KFM Folders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
### Version Beta 0.2 | |
### Created by Colorenz | |
### Extenstion Attribute to check if KFM Status | |
### KFM Values | |
### 0 = Off | |
### 512 = Desktop Backed Up | |
### 1024 = Documents Backed Up | |
### 1536 = Desktop and Documents Backed Up. | |
#Get Current logined User | |
CurrentUser=$(scutil <<<"show State:/Users/ConsoleUser" | awk '/Name :/ { print $3 }') | |
#Get Current User Home | |
KFMFolderStatus=$(/usr/libexec/PlistBuddy -c "print :AccountInfo_Business1:KfmSilentAttemptedFolders" /Users/${CurrentUser}/Library/Group\ Containers/UBF8T346G9.OneDriveStandaloneSuite/Library/Preferences/UBF8T346G9.OneDriveStandaloneSuite.plist) | |
#Check if KFM Status | |
case "$KFMFolderStatus" in | |
"0") /bin/echo "<result>KFM not activated</result>" | |
;; | |
"512") /bin/echo "<result>Desktop is activated</result>" | |
;; | |
"1024") /bin/echo "<result>Documents is activated</result>" | |
;; | |
"1536") /bin/echo "<result>Desktop and Documents is activated</result>" | |
;; | |
esac | |
Maybe have a file exist check for the plist or a dump errors in PlistBuddy. Extenstion Attribute can run at loginwindow which will give an error.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not use KfmFoldersProtectedNow instead of KfmSilentAttemptedFolders? KfmFoldersProtectedNow gives you the current status. KfmSilentAttemptedFolders will be 1536 even when KFM was stopped.