Created
January 12, 2015 20:21
-
-
Save jacobsalmela/226cd8c26f0460096047 to your computer and use it in GitHub Desktop.
Rename computers to prepend something
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get the entire computer name and save it in a variable | |
#existingName=$(hostname | cut -d'-' -f2-) | |
existingName=$(hostname) | |
# Set the computer name to Repurpose-"Existing computer name" | |
scutil --set LocalHostName "Repurpose-$existingName" | |
scutil --set ComputerName "Repurpose-$existingName" | |
scutil --set HostName "Repurpose-$existingName" | |
serialNum=$(ioreg -l | awk '/IOPlatformSerialNumber/ { split($0, line, "\""); printf("%s\n", line[4]); }') | |
# Set the NetBIOS name as the serial number | |
defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$serialNum" | |
# Update the JSS and change the building to "Recycled" | |
jamf recon -building Recycled |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment