Skip to content
Advertisement

Formatting Big List from AD Query / Python

Trying to write a program that will look at all users in AD and place them in the correct ADGroup based on location, job title, and job code. Currently I am using a query to pull all the users by department number. Which is working fine but the output I am getting is in a giant list that is formatted like below:

JavaScript

I am wanting to change the formatting so that it can actually be read and uploaded to a CSV file for latter use. Below is the code I have so far.

JavaScript

Advertisement

Answer

Assuming the formatting of the output is consistent, I’d say the following solves your problem:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement