Computer name script
Computer name script
- Subject: Computer name script
- From: "LaMantia, Brian" <email@hidden>
- Date: Wed, 04 Jul 2018 19:20:47 +0000
- Disclaimersource: eop
- Thread-topic: Computer name script
Hi all. My script is partially working. It will change the laptop computer name
in the format I want. Last 7 characters of the serial number + ML at the
beginning. The desktops do not work at all and I can’t figure out why. Any
thoughts? Thank you.
#!/bin/bash
serial=$(/usr/sbin/system_profiler SPHardwareDataType | /usr/bin/awk '/Serial\
Number\ \(system\)/ {print substr($0,length-6)}')
IS_Laptop="$(/usr/sbin/system_profiler SPHardwareDataType | grep "Model
Identifier" | grep "Book")"
laptop='ML'
desktop='MD'
if [ "$IS_LAPTOP" != "" ]; then
scutil --set LocalHostName "$desktop$serial"
scutil --set ComputerName "$desktop$serial"
scutil --set HostName "$desktop$serial"
else
scutil --set LocalHostName "$laptop$serial"
scutil --set ComputerName "$laptop$serial"
scutil --set HostName "$laptop$serial"
fi
The information contained in this message is proprietary and/or confidential.
If you are not the intended recipient, please: (i) delete the message and all
copies; (ii) do not disclose, distribute or use the message in any manner; and
(iii) notify the sender immediately. In addition, please be aware that any
message addressed to our domain is subject to archiving and review by persons
other than the intended recipient. Thank you.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden