Change Hostname on a bunch of Macs

If you just want change the hostname Domain then this works :
scutil --get HostName | cut -d . -f 1 | xargs -J d printf "%s%s\n" d "new.domain.server" | scutil --set HostName

It takes the current machines name, strips off the old domain and replaces it with the new domain