• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Changing machine name in OSX?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing machine name in OSX?


  • Subject: Re: Changing machine name in OSX?
  • From: Rob Morton <email@hidden>
  • Date: Wed, 22 May 2002 10:49:18 -0400

Well, assuming you mean the AppleTalk name, here is what I did...
TagID is just a variable that I get through display dialog. You can replace
1 with the actual admin password, enter it over and over again, or play
other tricks.


--Change Computer Name to Tag Number in preferences
do shell script ("touch
/private/var/db/SystemConfiguration/preferences.new") password "1" with
administrator privileges
do shell script ("chown locaadmin
/private/var/db/SystemConfiguration/preferences.new") password "1" with
administrator privileges
do shell script ("sed s/Local.Administrator...s.Computer/" & tagID & "/
/private/var/db/SystemConfiguration/preferences.xml >
/private/var/db/SystemConfiguration/preferences.new") ,
password "1" with administrator privileges
do shell script ("chown root
/private/var/db/SystemConfiguration/preferences.new") password "1" with
administrator privileges
do shell script ("mv /private/var/db/SystemConfiguration/preferences.new
/private/var/db/SystemConfiguration/preferences.xml") password "1" with
administrator privileges

--Change Computer Name to Tag Number in host
do shell script ("touch /etc/hostconfig.new") password "1" with
administrator privileges
do shell script ("chown locaadmin /etc/hostconfig.new") password "1" with
administrator privileges
do shell script ("sed s/Local.Administrator...s.Computer/" & tagID & "/
/etc/hostconfig > /etc/hostconfig.new") ,
password "1" with administrator privileges
do shell script ("chown root /etc/hostconfig.new") password "1" with
administrator privileges
do shell script ("mv /etc/hostconfig.new /etc/hostconfig") password "1" with
administrator privileges



While it is an AppleScript that is doing it, as you can see, it is barely
using AppleScript. I just figure sed does the task fast, and I may as well
start blending these things.

Hope that helps,
Rob Morton



on 5/21/02 8:35 PM, Gabe Benveniste at email@hidden wrote:

> is it possible to change the machine name in osx using applescript?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Changing machine name in OSX? (From: Gabe Benveniste <email@hidden>)

  • Prev by Date: DragThing - unpaid product endorsement
  • Next by Date: ignoring application completely
  • Previous by thread: Changing machine name in OSX?
  • Next by thread: adding text tom beginning of file FIXED, Now changing filenames s cript...
  • Index(es):
    • Date
    • Thread