Script to change a user password for GroupWise 2014

Script to change a user password for GroupWise 2014

Here's a script to change a user password.. some comments have been added to hopefully clarify what's going on.

#/bin/bash

# --- ipaddr, port and administrator for gwadmin service
IP=10.10.10.10
PORT=9710
GWADMIN=admin

# ---- Prompt for admin pwd so it isn't revealed in the script
echo "Enter GroupWise Admin Password: "
read ADMINPWD

# --- Prompt for GW userid, his/her postoffice and new pwd
# --- We want the postoffice in case there are duplicate userids in
the sytem
echo "Enter GroupWise UserID for password change: "
read GWID
echo "Enter Post Office for $GWID: "
read PO
echo "Enter new password for $GWID: "
read NEWPWD

#-- 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/user.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/user.csv?name=$GWID&postoffice=$PO&attrs=domain,postoffice,name"

# --- use curl to search the admin service for the user,and gawk to
build the proper user url
url=`curl -k --user $GWADMIN:$ADMINPWD $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 were
using a json doc
curl -k --user $GWADMIN:$ADMINPWD -H "Content-Type:application/json" -X
PUT $url --data $DATA
echo "Password changed"
# --- end of script


This is a use at your own risk script.  Please make sure that you have a complete, working backup of your GroupWise system before using.

 
Labels (1)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
5 of 5
Last update:
Friday
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.