#!/bin/bash ######################################################################################### # Shellscript : Set Computername # Autor : Andreas Vogel, nextenterprise gmbh ######################################################################################### #set -x ######################### Variablen ##################################################### ComputerName=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}') scutil --set ComputerName "$ComputerName" scutil --set LocalHostName "$ComputerName" scutil --set HostName "$ComputerName" scutil --set HostName "$ComputerName" jamf recon ######################### read Username ################################################# currentUser=$(stat -f '%u %Su' /dev/console | cut -d ' ' -f 2) endUsername=$(dscl . read /Users/$currentUser RecordName | awk {'print $2'}) realname=$(dscl . read /Users/$currentUser RealName | tail -n1) email=$(dscl . read /Users/$currentUser dsAttrTypeStandard:NetworkUser | awk '{print $2}') jamf recon -endUsername "$endUsername" -realname "$realname" -email "$email" exit 0