Difference between revisions of "Removing a user from all DLs on a server"

(Created page with "=== <h1>Removing a user from all DLs on a server</h1>=== <hr> <br> <h2>Problem:</h2> Removing a user from all DLs on a server <h2>Solution:</h2> We can do this using a com...")
 
Line 10: Line 10:
 
We can do this using a combination of zmsoap and zmprov<br><br>
 
We can do this using a combination of zmsoap and zmprov<br><br>
 
'''1).''''zmsoap' will get a list of all the distribution lists the user is a member of. So for 'user@example.com':
 
'''1).''''zmsoap' will get a list of all the distribution lists the user is a member of. So for 'user@example.com':
<pre> zmsoap -z GetAccountMembershipRequest/account=user@example.com @by=name</pre>
+
zmsoap -z GetAccountMembershipRequest/account=user@example.com @by=name
  
 
'''2).'''Use this to make a 'zmprov' script that will run 'zmprov rdlm dl@example.com user@example.com' for all the DLs:
 
'''2).'''Use this to make a 'zmprov' script that will run 'zmprov rdlm dl@example.com user@example.com' for all the DLs:
  zmsoap -z GetAccountMembershipRequest/account=user@example.com @by=name | sed -n 's/.*name="\(.[^"]*\)".*/rdlm \1 user@example.com/p' > /tmp/rdlm.zmprov
+
zmsoap -z GetAccountMembershipRequest/account=user@example.com @by=name | sed -n 's/.*name="\(.[^"]*\)".*/rdlm \1 user@example.com/p' > /tmp/rdlm.zmprov
  
 
The above creates a file '/tmp/rdlm.zmprov', which contains multiple lines in the form of 'rdlm dl@example.com user@example.com'.
 
The above creates a file '/tmp/rdlm.zmprov', which contains multiple lines in the form of 'rdlm dl@example.com user@example.com'.
  
 
'''3).'''This file is then 'fed' into zmprov, like so, removing the user from all the DLs:
 
'''3).'''This file is then 'fed' into zmprov, like so, removing the user from all the DLs:
<pre>zmprov < /tmp/rdlm.zmprov</pre>
+
zmprov < /tmp/rdlm.zmprov  
  
  
Shashank
+
 
 +
Submitted by:  Shashank Tewari

Revision as of 06:47, 21 August 2017

Removing a user from all DLs on a server



Problem:

Removing a user from all DLs on a server


Solution:

We can do this using a combination of zmsoap and zmprov

1).'zmsoap' will get a list of all the distribution lists the user is a member of. So for 'user@example.com':

zmsoap -z GetAccountMembershipRequest/account=user@example.com @by=name

2).Use this to make a 'zmprov' script that will run 'zmprov rdlm dl@example.com user@example.com' for all the DLs:

zmsoap -z GetAccountMembershipRequest/account=user@example.com @by=name | sed -n 's/.*name="\(.[^"]*\)".*/rdlm \1 user@example.com/p' > /tmp/rdlm.zmprov

The above creates a file '/tmp/rdlm.zmprov', which contains multiple lines in the form of 'rdlm dl@example.com user@example.com'.

3).This file is then 'fed' into zmprov, like so, removing the user from all the DLs:

zmprov < /tmp/rdlm.zmprov 


Submitted by: Shashank Tewari

Jump to: navigation, search