Skip to content

Instantly share code, notes, and snippets.

@tied
Forked from greeno/gist:5725631
Created January 19, 2023 07:20
Show Gist options
  • Save tied/3bbcf130568fb5a2b86b734a218cc9b5 to your computer and use it in GitHub Desktop.
Save tied/3bbcf130568fb5a2b86b734a218cc9b5 to your computer and use it in GitHub Desktop.
Do you have user accounts automatically created in Confluence? Do most of these users never create content? Are you close to your Confluence license? Then this script is for you! It really just tries to remove EVERYONE from Confluence. The good part is that it fails if the user has content. So it will just remove the readers which is a good thin…
import xmlrpclib
url = "https://your-confluence.awhere"
s = xmlrpclib.ServerProxy(url + "/rpc/xmlrpc")
print "Logging in..."
token = s.confluence2.login("username","*****")
if not token:
print "No Token!!"
allUsers = s.confluence2.getActiveUsers(token,True)
for user in allUsers:
print "Removing user: %s"%user
try:
s.confluence2.removeUser(token,user)
except Exception:
print "Could not remove user: %s"%user
print "Has content!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment