Hey all, I am looking to create a script that when ran it will grab the Serial Number and set it as the HostName, LocalHostName, & ComputerName. I needed some help with getting it to run without the prompt for an Administrator username and password. So far this is what I have below and I apologize ahead of time I am VERY new to this and trying to learn.
1set sys to do shell script "/usr/sbin/system_profiler SPHardwareDataType " without altering line endings23set StringVariable1 to "Serial"45set Serial_Number to do shell script "/usr/sbin/system_profiler SPHardwareDataType | awk '/Serial/ { print $NF }' "678do shell script "scutil --set HostName " & Serial_Number with administrator privileges9do shell script "scutil --set LocalHostName " & Serial_Number with administrator privileges10do shell script "scutil --set ComputerName " & Serial_Number with administrator privileges1112display dialog "The Mac has been renamed to " & Serial_Number