sense-of-security / ADRecon

ADRecon is a tool which gathers information about the Active Directory and generates a report which can provide a holistic picture of the current state of the target AD environment.
https://senseofsecurity.com.au/
GNU Affero General Public License v3.0
1.7k stars 279 forks source link

Export to JSON gives XML output. #9

Closed coaksford closed 6 years ago

coaksford commented 6 years ago

Choosing options to export to JSON gives XML output.

The JSON object is a string which does not have a .Save() method, it looks like this line was copied from the XML option where the XML object does have a .Save() method, so I just copied this from the HTML function and it works correctly.

Replace line 4159 in Function Export-ADRJSON, originally:

(ConvertTo-JSON -InputObject $ADRObj).Save($ADFileName)

with:

ConvertTo-JSON -InputObject $ADRObj | Out-File -FilePath $ADFileName

This looks like it was just an oversight while copying and pasting the XML function, but the Export-ADRJSON function was actually never called from anywhere in the script.

Replace line 4316 in Function Export-ADR, originally:

Export-ADRXML -ADRObj $ADRObj -ADFileName $ADFileName

with:

Export-ADRJSON -ADRObj $ADRObj -ADFileName $ADFileName

prashant3535 commented 6 years ago

Thanks. Have pushed the fix.