Previously, I used to have the below code to get workgroup / domain name of the active directory service provider.
SCDynamicStoreRef storeRef = SCDynamicStoreCreate(NULL, (CFStringRef)@"GetWorkgroup", NULL, NULL); CFPropertyListRef global = SCDynamicStoreCopyValue (storeRef,CFSTR("State:/Network/Global/SMB")); id workgroup = [(__bridge NSDictionary *)global valueForKey:@"Workgroup"];
On few Macs (probably starting from Sonoma), the workgroup property is not set. What is the alternative to get this information programatically?