Parse gpresult /h into json file

Is it possible to get the output of gpresult in json file format?

Using the command line argument /h would be a bad idea because you would need to parse HTML files. Instead you could use /x. With enough efford it might be worth it to parse the XML output with PowerShell and convert it to JSON.

But as usual the actual question should be “why” you want to have the output in JSON?

The output is a bit complicated … trying to extract information from Winning GPO like Maximum password age and pick the result in days and put into a json collection in order to be easy readible by other queries :smile:

That’s why I recommended to use the command line argument /x instead of /h. It outputs the result in XML which is somewhat easier to parse than HTML. :wink:

And please do not post images of code or plain text output. Instead post the plain text and format it as code.