How to delete enterprise (only) users

We have hundreds of users who have left the company/removed from active directory who have left behind orphaned enterprise aliases. Is there a script somewhere that can identify users who only have an enterprise login (except admin of course) and remove them?

Someone wrote an excel macro that can extract a user list and the groups they are in. I have used it in the past, but not sure if can automatically delete users. Do a search to find it.

Edit: See this:

It might work to use the Enterprise Alias Manager within the BI Platform Support Tool to delete all of the enterprise aliases for a given group and then recreate them for that same group. I have not tried this myself. I recommend considerable research and testing. If you are not comfortable with this approach DO NOT USE IT. In that case you would be better off deleting them manually.

If you just want to get a list of them and export them to Excel you can use CMS Query Builder from biclever.com to do that.

Noel

Ah yea, I tried this first. It will delete AD aliases leaving you with just your boe enterprise alias. But it won’t delete the enterprise alias/user itself.

It’s actually pretty easy to do this using the Java SDK.

A basic outline for the code is:

  1. Login to get an IEnterpriseSession and an IInfoStore.
  2. Send a query to the IInfoStore object to get an IInfoObjects. The query will be:

Select SI_ID, SI_NAME, SI_ALIASES from CI_SYSTEMOBJECTS where SI_ALIASES.SI_TOTAL = 1 and not SI_NAME in (‘Administrator’, ‘Guest’,‘SMAdmin’,‘QaaWSServletPrincipal’)

  1. Walk through the individual IInfoObject instances in the IInfoObjects and check the aliases. Delete the users who only have an Enterprise alias. The code looks something like this:
IInfoObjects iobjs = myInfoStore.query("Select SI_ID, SI_NAME, SI_ALIASES from CI_SYSTEMOBJECTS where SI_ALIASES.SI_TOTAL = 1 and not SI_NAME in ('Administrator', 'Guest','SMAdmin','QaaWSServletPrincipal')"
if (iobjs <> null) {
  int delCount = 0:
  for(final IInfoObject iobj : iobjs) {
    IUser usr = (IUser) iobj;
    final IUserAliases aliases = usr.getAliases();
    final IUserAlias alias : aliases[1];  //arrays from the SDK are 1-based instead of 0-based
    if (alias.getType() == IUserAlias.ENTERPRISE) {
      iobj.delete();
      delCount++;
      break;
    }
  }
  if (delCount > 0) {
    iobjs.commit();
  }
}

I haven’t tested this specific code, so you may have to tweak it to get it to work, but it is based on other things that I’ve done.

-Dell

2 Likes