This script is written to delete users created according to the following pattern.
If the username is Test,
Test001
Test002
...
Test010
Test011
...
Test099
Test100
You can modify the script according to your requirement.
#!/bin/bash
username=<username>
echo "Started deleting users"
for i in `seq -w 1 100`
do
curl -v -k --user <username>:<password>
https://<hostname>:<port>/services/UserAdmin.UserAdminHttpsSoap11Endpoint/
--data '<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:deleteUser>
<!--Optional:-->
<xsd:userName>'"${username}${i}"'</xsd:userName>
</xsd:deleteUser>
</soapenv:Body>
</soapenv:Envelope>' --header "Content-Type:text/xml" --header "SOAPAction:urn:deleteApplication"
echo "Deleted user : ${username}${i}"
done
echo "Completed deleting users"
Hope it is useful :)
No comments:
Post a Comment