Batch Rename OSX Clients 
07/06/2016 - Shawn, Work, OSX
Posted by Administrator
In ARD run a unix task on the computers you want to rename. Select the bubble for the user and say root. The command you want to run is all that is in the block quote below.

#!/bin/bash

/usr/bin/osascript << EOF
property compName : ""

repeat while compName is ""
tell application "Finder"
activate
display dialog "What should this computer be named:" default answer compName
set compName to text returned of result
end tell
end repeat

try
do shell script "hostname " & quoted form of compName
on error errorMsg number errorNum
display alert "Error " & errorNum message errorMsg buttons "Cancel" default button 1
end try
EOF

name=$(hostname)
scutil --set ComputerName "${name}"
scutil --set LocalHostName "${name}"

add comment ( 15679 views )   |  permalink

| 1 | 2 | 3 | Next> Last>>