Is there any easy way to read "/Library/Managed Preferences" files?

In my case, I deployed a Preferences file via MDM tool which called Intune to my Mac. And then, the system created a file named "com.mycompany.test.plist" in "/Library/Managed Preferences" folder.

I searched from Google, there are many discussion about using NSUserDefaults API to get these configuration values, for example: https://developer.apple.com/forums/thread/127039

I also create a app with Xcode and it's bundle id is also "com.mycompany.test.plist", but the result is nil, method is as follows: NSDictionary *serverConfig = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"com.apple.configuration.managed"];

Any one can tell me how to get the configurations? or is there something wrong with my understanding?

They are plist files (some are binary) , so you could run plutil -p "/Library/Managed Preferences/com.mycompany.test.plist" from the command-line to view the file contents.

In an application, you could do something like

        [[NSUserDefaults standardUserDefaults] addSuiteNamed: @"com.mycompany.test" ];
        id object = [[NSUserDefaults standardUserDefaults] objectForKey:@"SomeKey" ];
Is there any easy way to read "/Library/Managed Preferences" files?
 
 
Q