I am working off this collate script on the ADMU Github. The script runs and downloads the .json files as expected. The error comes during the collation step of the script. Line 56 throws an error:
ConvertFrom-Json : Invalid JSON primitive: . At C:\Users\BenjaminGarrison\Documents\WindowsPowerShell\Scripts\admu_collate.ps1:56 char:74 + ... Get-Content -Raw $File.FullName -Encoding unicode | ConvertFrom-Json + ~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand
It creates an empty CSV file. Since it's downloading from Github, I am guessing there might be an issue with the encoding and therefore throwing this error. Has anyone been able to successfully use this script? I know this was maintained by Brad Stevens and he is no longer at JC. Not sure if Joe Workman is still around though.
I changed the line
$combinedjson += Get-Content -Raw $File.FullName -Encoding unicode | ConvertFrom-Json
To the following:
$combinedjson += Get-Content -Raw $File.FullName | ConvertFrom-Json
And it executed without errors. I am guessing the Unicode encoding was adding some hidden characters to filename. If anyone else has a different solution, please let me know
Thanks for this, Long story short there was an encoding issue with the previous version of the PowerShellForGitHub module. Now that the module has been updated, @bgarrison is right and the encoding part is no longer needed.
We had this queued up for a pull request and that just went out today with ADMU version 2.0.7