Skip to content

Instantly share code, notes, and snippets.

@gregneagle
Created August 13, 2014 17:23
Show Gist options
  • Save gregneagle/60ce73c7e267d993f1c1 to your computer and use it in GitHub Desktop.
Save gregneagle/60ce73c7e267d993f1c1 to your computer and use it in GitHub Desktop.
Using the SystemConfiguration framework via PyObjC to get "ComputerName"
import SystemConfiguration
prefs = SystemConfiguration.SCPreferencesCreate(None, "SystemConfiguration", None)
print SystemConfiguration.SCPreferencesGetValue(prefs, "System")["System"]["ComputerName"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment