Thanks for visiting the site !!! Visit below intrested Ads to support us if you like the site .Sharing is caring .keep distance and keep safe . Happy Learning ... 😀

List user’s and its roles from Weblogic using wlst script

List Weblogic Admin console user’s using script

We can login in to Weblogic Admin console to see the List of ID’s and roles .
In this page we will see how to list the user’s and role from the script.

cat listUser.wlst
#-----------------
connect('weblogic','password','t3://HOSTNAME:5100')
domainRuntime()
cd('/DomainServices/DomainRuntimeService/DomainConfiguration/ABCDomain/SecurityConfiguration/abcDomain/DefaultRealm/myrealm/AuthenticationProviders/DefaultAuthenticator')
cmo.exportData('DefaultAtn','/tmp/export.ldif', Properties())
exit()

Replace the HOSTNAME With correct Hostname or IP Address ,userid and passwrod .Above wlst will export the data into /tmp/export.ldif
/tmp/export.ldif is txt readable file . Part it using shell script to print the username and roles.

cat listUser.sh
---------------
#!/bin/ksh
echo "Printing User ID <--> Groups "
while read line ; do
if [ -z "$line" ]; then
ID=`cat /tmp/id.txt| grep -i "dn: uid="`
if [ ! -z "$ID" ] ; then
echo "`cat /tmp/id.txt| grep -i \"dn: uid=\" |awk -F"," '{ print $1 }'` <--> `cat /tmp/id.txt | grep \"wlsMemberOf:\" | awk -F"," '{ print $1 }'`"
fi
>/tmp/id.txt
continue;
else
echo $line >> /tmp/id.txt
fi
done</tmp/export.ldif

Now you can run one by one script .

chmod 755 listUser.wlst listUser.sh
./listUser.wlst 
./listUser.sh

The above 2 will get the list of UserID and it’s roles created in Weblogic Domain .

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *