Posted on 11-16-2011 08:50 AM
For reasons i wish not to discuss, our MacBooks need to belong to a specific workgroup. Is there a way to script changing Windows workgroup name?
Thanks,
Shannon L Rico
Sr. Network Engineer
CVE4
GISD
d: 972-487-3663
c: 214-882-3621
Posted on 11-16-2011 12:12 AM
Maybe? http://macmule.com/2011/09/09/how-to-change-the-automatic-proxy-configuration-url-in-system-preferences-via-a-script/
Regards,
Ben.
Posted on 11-16-2011 12:19 AM
Sorry wrong e-mail.
Regards,
Ben.
Posted on 11-16-2011 09:12 AM
"Shannon Rico" <SLRico at garlandisd.net> writes: For reasons i wish not to discuss, our MacBooks need to belong to a specific workgroup. Is there a way to script changing Windows workgroup name?
The file you're looking to modify is /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist and since its a plist you'll have to search and update the file. There have been a few postings in the past on this list about changing a plist file.
Since you need to search and update a specific line in the file you'll probably have to script something with plistbuddy to do it.
Something like:
/usr/libexec/plistbuddy -c "Set :Workgroup desiredworkgroupname" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
should do the trick. You could put it into a shell script or just use it as a one-liner in the Advanced tab of a policy.
WARNING! Test this thoroughly before deployment. I've been burned before by scripts, so use with caution. Good luck.
Gene Anderson
Systems Analyst, ACTC, MCP, CCA
Pembina Hills Regional Division No.7
Phone: (780) 674-8535 ext 6860
email: ganderson at phrd.ab.ca
Posted on 11-16-2011 09:48 AM
this will do it
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server Workgroup "mshome"
just change mshome to whatever you want the workgroup to be
?xml version="1.0" encoding="UTF-8"?> Default Title
Posted on 03-05-2018 05:42 AM
I know this post is a little older, but can anyone expand on how to remove the "WORKGROUP" option? I can get it working if I run it using something like:
/usr/bin/defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server "NetBIOSName" $compName
/usr/libexec/plistbuddy -c "add :Workgroup string $Workgroupname" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
/usr/libexec/smb-sync-preferences 2>/dev/null
sleep 5
/usr/libexec/plistbuddy -c "Print" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
/usr/bin/defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server "NetBIOSName" $compName
/usr/libexec/plistbuddy -c "add :Workgroup string $Workgroupname" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
/usr/libexec/smb-sync-preferences 2>/dev/null
/usr/libexec/plistbuddy -c "Print" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
Though, it doesn't stick or stay persistent between users ie: local admin and assigned user.
Is there some configuration somewhere else that I'm missing? Maybe in the API for SystemConfiguration? I've even reached out to Apple Developer support on this one with radio silence.