applescripting Machine Name
applescripting Machine Name
- Subject: applescripting Machine Name
- From: Tyson Brown <email@hidden>
- Date: Thu, 01 Mar 2001 16:34:38 -0600 (CST)
Hi,
I am a relative newby to applescripting, but I have an interesting problem
I would like to bounce off people here, and perhaps a script that may be
useful or could be revised by someone who knows more applescript than what
I do.
Ok, here goes. I am looking at using Apple Software Restore and possibly
Netboot with OS X Server to manage my lab of 24 iMacs and 2 G3s. I hope
to create an OS 9.1 image for both the iMacs and the G3s' We are running
a product called MacAdministrator for controlling access to all the
machines. What I need to be able to do is find some way to change the
machine name of each machine to a designated unique name, likely based on
the
ethernet address, since it is unique to every machine. The machine names
must be unique because MacAdministrator uses the machine name to name its
client software, and it logs usage of each machine based on the name
assigned to its client software. One of my student assistants wrote up
the following script to name each machine uniquely, based on the Ethernet
address
tell application "Finder"
activate
select file "Apple System Profiler" of folder "Apple Menu Items"
of folder "System Folder" of startup disk
open selection
end tell
tell application "Apple System Profiler"
set theAddress to AppleTalk address
tell application "File Sharing"
activate
if theAddress = "00.30.65.51.AE.4A" and computer name is
not equal to "Pink" then
set computer name to "Pink"
else if theAddress = "00.30.65.50.E5.E0" and computer name
is not equal to "Purple" then
set computer name to "Purple"
end if
quit
end tell
activate
quit application "Apple System Profiler"
end tell
A bit cumbersome with all the else if statements, but it works. The
problem is, I need to run this script BEFORE the MacAdministrator software
loads on startup, because as soon as it loads during its first bootup, it
renames the MacAdministrator client extension to whatever is in the
Filesharing Control Panel for Macintosh Name. Once the client extension
is named, it cannot be changed save by going in with ResEdit and changing
the pertinent string resource within the extension. Since the
MacAdministrator software loads up before the Startup Items get run, I
cannot just put it in the Startup Items folder. Does anybody out there
know of a way to get an Applescript to run during the bootup process, as
an extension possibly? Or, alternatively, does anybody know where in the
Mac OS the Mac Name is kept, so that I could go and wipe it out for my
clients? I know it is kept in the Users and Group
Preferences, but even if you go in with a hex editor and wipe it out, as
soon as you reopen the filesharing control panel the Mac name shows up
again, the same as before. Once the machine is named, of course, they say
you cannot remove the name. My final fallback will be to rebuild my image
again, without putting a filesharing name in, then see if an unnamed
MacAdministrator client extension will grab the Applescript assigned name
after the boot sequence.
Tyson Brown, B.Ed | Ph.#: (306) 966-6156
Programmer | Fx.#: (306) 966-4938
Consulting & Development | E-Mail:email@hidden
Department of Computing Services | URL:
http://duke.usask.ca/~brownt