Set NetBios name to Computer Name

Hello.

Is it possible, via Terminal, to set the Netbios name of a system to the computer's current name as set in the Sharing panel? I have a ton of computers to configure, and this would make my job much faster.

Regards, Andrew.

iMac 24", Mac OS X (10.5.6)

Posted on Jun 11, 2010 5:10 AM

Reply
3 replies

Jun 13, 2010 9:17 AM in response to emptythetill

Hi,

the actual computer name is stored in a system variable named HOSTNAME. Just type echo $HOSTNAME to retrieve that value:

---------------snip-------------
$ echo $HOSTNAME
pronto-macpro
---------------snap-------------

If there is a NetBIOSName already configured, the value is stored in /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist:

---------------snip-------------
$ defaults read /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName
Pronto-MacPro1
---------------snap-------------

With this informations you should be able to set the NetBIOSName equal to the hostname by using the command (type the following in one line!):

---------------snip-------------
$ sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName $HOSTNAME
---------------snap-------------

To verify if it works just type the defaults read command again:

---------------snip-------------
$ defaults read /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName
pronto-macpro
---------------snap-------------

Hope that helps

Bye Tom

Message was edited by: prontosystems

Jun 27, 2010 10:13 AM in response to emptythetill

Hi,

negative, it isn't perfect. I figured out that the NetBIOSName changed back to the earlier value after reboot or after checking the new name in the network prefPane. Mac OS store the network settings in an even more complex manner. I traced the hard disk IOs during changing the value in the network prefPane and figured out that there are two plists changed -> com.apple.smb.server.plist and preferences.plist.

Unfortunately it's not so trivial to change this value in a terminal as it seems in my first posting. Because Mac OS is able to determine automatically the location in which the system is currently located, the multiple network settings are stored in a dynamic store technology located in multiple plist files in /Library/Preferences/SystemConfiguration.

The right command line tool to work with this dynamic store is scutil but I didn't find a proper way to change the value for the NetBIOSName. Sorry for my misdirect and please keep in mind, that to change this specific value by the defaults system isn't supported and isn't the proper way.

Bye Tom

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Set NetBios name to Computer Name

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.