davehull / Kansa

A Powershell incident response framework
Apache License 2.0
1.56k stars 266 forks source link

Kansa Core: Output target list to file when Kansa queries AD for hosts. #114

Closed jvaldezjr1 closed 9 years ago

jvaldezjr1 commented 9 years ago

Write the target list from "Get-Targets" to a file. This may be helpful later on to have this stored in a central location, or useful to run additional module against same set of hosts and not have to query AD again.

jvaldezjr1 commented 9 years ago

Starting after line 446 is where I inserted this code to write the targets to a file.

Added code to save the target list when AD is queried for hosts, and write data to a file. There was some replication issues with some AD objects, so I've also added code to resolve those. In some AD environments, when there are duplicate object names, AD will add the objectGUID to the Name displayed in the format of "hostname\0ACNF:ObjectGUID". If you expand the property Name, you get 2 lines returned, the hostname, and then CNF:ObjectGUID. Code will take the first line from that object and reassign it back into the targets list.

I created a pull request to merge the code to do this from my fork.

davehull commented 9 years ago

Thank you!

jvaldezjr1 commented 9 years ago

No problem!