#/bin/bash echo " " read -p "Enter GroupWise Admin Service IP/Hostname: " IP echo " " read -p "Enter Groupwise Admin Service Port: " PORT echo " " read -p "Enter GroupWise System Administrator: " GWADMIN echo " " read -p "Enter GroupWise Administrator Password: " PWD echo " " read -p "Enter Group name: " GROUP echo " " read -p "Enter New Password: " NEWPWD echo " " #-- build base url for admin service BASEURL="https://$IP:$PORT/gwadmin-service" # --- create json data for the new password DATA="{\"userPassword\":{\"value\":\"$NEWPWD\"}}" # --- build url to search for the user. the /list/group_member.csv will return the user data in csv format. # --- attrs= returns only the users domain,po and gwid, so we can build the url to change the pwd SEARCHURL="$BASEURL/list/GROUP_MEMBER.csv?attrs=memberDomainName,memberPostOfficeName,memberName&filter=name%20eq%20%27$GROUP%27" # --- use curl to search the admin service for the user,and gawk to build the proper user url URLS=`curl -k --user $GWADMIN:$PWD $SEARCHURL |gawk --field-separator=, 'NR!=1 {print"'$BASEURL'/domains/"$1"/postoffices/"$2"/users/"$3"/clientoptions"}'` # --- now use curl to change the pwd. note content-type cause we are using a json doc #echo 'curl -k --user '$GWADMIN':'$ADMINPWD' -H "Content-Type:application/json" -X PUT '$url' --data '$DATA'' >> url.txt # for debuging only curl -k --user $GWADMIN:$PWD -H "Content-Type:application/json" -X PUT $URLS --data $DATA echo " " echo "Passwords have been changed" echo " " echo "Please be patient" echo "It may take a while for the change to propagate through your GroupWise systems" echo " " echo " "