Skip to content

Instantly share code, notes, and snippets.

@aanklewicz
Created January 15, 2021 23:45
Show Gist options
  • Save aanklewicz/bc9cebba4b4a8e557e805cacd1fc0cce to your computer and use it in GitHub Desktop.
Save aanklewicz/bc9cebba4b4a8e557e805cacd1fc0cce to your computer and use it in GitHub Desktop.
#!/bin/sh
# Usage ./Onboarding\ students.sh -f Jean-Luc -l Picard -g 2040
# -g is the year the student graduates, as emails look like jean-luc.p@2040.domain.com
# -g is also used to put them in the right OU which is /Students/2040Grads
while getopts "f:g:l:" opt; do
case $opt in
f) FIRSTNAME=$OPTARG ;;
g) GRAD=$OPTARG ;;
l) LASTNAME=$OPTARG ;;
*) echo 'error' >&2
exit 1
esac
done
EMAIL="${FIRSTNAME}.${LASTNAME:0:1}@${GRAD}.domain.com"
ORG="/Students/${GRAD}Grads"
PASSWORD=$(curl https://www.dinopass.com/password/simple)
# create the user
~/bin/gam/gam create user ${EMAIL} firstname ${FIRSTNAME} lastname ${LASTNAME} password ${PASSWORD} changepassword on org ${ORG}
echo "${EMAIL}'s password is ${PASSWORD}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment