Bulk User Delete based on Domain via python script invoked from command prompt

Bulk User Delete based on Domain via python script invoked from command prompt

Please refer to the below link to install and configure python on the server.

Steps for configuring the script:
  1. Extract the zip in a particular location, eg:  <sdp_home>\integration\custom_scripts
  2. Update the app url and technician_key in the script.

  3. Follow this link to create integration key: https://pitstop.manageengine.com/portal/en/kb/articles/creating-integration-key
  4. Create a Query Report with the below query and save it with a name.
    1. SELECT aaauser.user_id "userid",aaauser.first_name AS "name",AaaLogin.DOMAINNAME "domain" FROM  PortalUsers
      LEFT JOIN SDUser sduser ON portalusers.USERID=sduser.USERID
      left join aaauser on sduser.userid=aaauser.user_id
      LEFT JOIN AaaUserContactInfo ON AaaUser.USER_ID=AaaUserContactInfo.USER_ID
      LEFT JOIN AaaContactInfo ON AaaUserContactInfo.CONTACTINFO_ID=AaaContactInfo.CONTACTINFO_ID
      LEFT JOIN AaaLogin ON AaaUser.USER_ID=AaaLogin.USER_ID
      where sduser.status='ACTIVE' and portalusers.userid not in (select userid from portaltechnicians) and
      AaaLogin.DOMAINNAME = 'sdptest'
    2. Assumptions: 
      1. Domain is "sdptest"
      2. Also, please maintain the same names for the columns(userid, name, domain) as they are used within the script.
    3. Please update the above as per your instance in the query and export the report as a csv file.
    4. Save the exported file in the same location as the python file. 
  5. Open command prompt with administrator permission and invoke the below command. CMD: py delete_sdp_user_csv.py <report_filename>.csv


                  New to ADSelfService Plus?

                    • Related Articles

                    • Bulk Request Delete via python script invoked from command prompt

                      Please refer to the below link to install and configure python on the server. https://pitstop.manageengine.com/portal/kb/articles/how-to-setup-python-on-the-server/ Steps for configuring the script: Extract the zip in a particular location, eg:  ...
                    • Bulk request edit via python script invoked from command prompt

                      Please refer to the below link to install and configure python on the server. https://pitstop.manageengine.com/portal/kb/articles/how-to-setup-python-on-the-server/ Steps for configuring the script: Extract the zip in a particular location, eg: ...
                    • Bulk request edit via python script invoked from command prompt

                      Please refer to the below link to install and configure python on the server. https://pitstop.manageengine.com/portal/kb/articles/how-to-setup-python-on-the-server/ Steps for configuring the script: Extract the zip in a particular location, eg: ...
                    • Python script to automate FCR

                      Please find the attached Python script on this link  to automate FCR via custom trigger when the request is created and resolved by the same technician. The link contains two Python scripts with the name FCR.py (this script can be used when MSP is ...
                    • Request add attachment_Python script-API

                      Steps for adding attachment to the request through python script-API. Extract the attached  "Attachment_Python_Script.zip" >> Edit attachmentscript.py >>Mention product installed url in the base url ; update the api key; update the request id that ...