I needed a power shell script that would pull all the members out of a group and pipe them to a CSV. I could get it to work if I used FT (format command to the screen but I remember we cannot pipe formatted stuff to csv)
I figured out how to do this but it was kind of corny, and I don’t think it was done properly. I don’t really study powershell anymore as the last year or so has been spent getting my CCNA and now working on my CCNP. I love Power Shell and use to study it but I never got to use much of it at work which is why I pushed hard in the network direction.
Anyway my code below worked but but put a bunch of crud into the csv and I cheated by then saving it as a Excel workbook and just deleting out the columns I did not want.
What would be a much cleaner and better way to do this where my outputted information was only the properties that I wished instead of all the generic properties?
I was thinking maybe the word DistinguishedName was spelled incorrectly but I looked a user up under Attribute Editor in the Active directory and that looks to be the correct Attribute name and spelling.
I found this post that said something about a bug its very close to the same error but not sure if that is related or not but figured I would share the website.
un-tested as I don’t have domain to play with, but this little tweak should do the trick. I’d say that using
$member.DistinguishedName would not work inside the filter as ad module is a bummer.