Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- usage()
- {
- echo "usage: sysinfo_page [[[-f file ] [-i]] | [-h]]"
- }
- #### Main
- while [[ $# -gt 0 ]]
- do
- key="$1"
- case $key in
- -ad | --domain ) domain="$2"
- shift # past argument
- shift # past value
- ;;
- -u | --username ) username="$2"
- shift # past argument
- shift # past value
- ;;
- -p | --password ) password="$2"
- shift # past argument
- shift # past value
- ;;
- --default)
- DEFAULT=YES
- shift # past argument
- ;;
- *) # unknown option
- shift # past argument
- ;;
- esac
- done
- ## More variables - No need to edit
- olddomain=$( dsconfigad -show | awk '/Active Directory Domain/{print $NF}' )
- computername=$( scutil --get ComputerName )
- adcomputerid=$( echo "${computername}" | tr [:lower:] [:upper:] )
- prefix="${adcomputerid:0:6}"
- echo "Using computer name '${adcomputerid}'..."
- echo ""
- ## Unbind if already bound
- # If the domain is correct
- if [[ "${olddomain}" == "${domain}" ]]; then
- # Check the id of a user
- id -u "${username}" > /dev/null 2>&1
- # If the check was successful...
- if [[ $? == 0 ]]; then
- echo -n "This machine is bound to AD. Unbinding..."
- # Unbind from AD
- dsconfigad -remove -force -u "${username}" -p "${password}"
- # Re-check the id of a user
- id -u "${username}" > /dev/null 2>&1
- # If the check was successful...
- if [[ $? == 0 ]]; then
- echo "Failed (Error code: 1)"
- exit 1
- else
- echo "Success"
- echo ""
- fi
- fi
- fi
- ## Perform bind
- echo "binding to domain ${domain}"
- dsconfigad -add "${domain}" -username "${username}" -password "${password}" \
- -computer "${adcomputerid}" -useuncpath enable -mobile enable \
- -mobileconfirm disable -shell /bin/bash -force \
- ## -ou "${ou}"
- ## Set show input menu in login window to TRUE
- echo "Setting the login window"
- defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool TRUE
- ## Set login window to use Name & Password
- echo "Setting login by user name and password"
- defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool true
- ## Set Login Message
- echo "Setting login message"
- sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "Property of Nomensa Ltd"
- ## Set Nomensa Wallpaper
- echo "Set Nomensa Wallpaper"
- osascript -e 'tell application "Finder" to set desktop picture to "/Users/admin/Desktop/2560x1440.png" as POSIX file'
- ## Munki Config
- echo "setting munki config"
- defaults write /Library/Preferences/ManagedInstalls.plist ClientIdentifier ${adcomputerid}
- defaults write /Library/Preferences/ManagedInstalls.plist SoftwareRepoURL https://munki.intranet.nomensa.com/munki_repo
- ## Install Fonts
- ## Check if we need to use ~ or not
- ## cd ~/Library/Fonts && { curl -O 'https://github.com/FrankHassanabad/ResumeBuilder/blob/master/fonts/src/main/resources/frankhassanabad/com/github/windowsfonts/BRLNSR.TTF' ; cd -; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement