Share via

Powershell: Get-DnsServerResourceRecord -ZoneName test.com|ConvertTo-Json 'System.OutOfMemoryException'

Anonymous
2022-08-22T13:11:02+00:00

Hi,

I'm working on a project trying to parse the contents of the zones and records.

I'm using the below command to get the data in the json format.

Get-DnsServerResourceRecord -ZoneName test.com|ConvertTo-Json

The command works fine for small amount of data, but when I try to extract info of a zone which consists of thousands of records, I'm encountering the below issue.

Generic failure

At line:1 char:1

  • Get-DnsServerResourceRecord -ZoneName test.com|ConvertTo ...
  • 
        + CategoryInfo          : NotSpecified: (PS\_DnsServerResourceRecord:root/Microsoft/...rResourceRecord) [Get-DnsServerResourceRecord], CimException 
    
        + FullyQualifiedErrorId : HRESULT 0x80041001,Get-DnsServerResourceRecord 
    
    

ConvertTo-Json : Exception of type 'System.OutOfMemoryException' was thrown.

At line:1 char:61

  • ... nsServerResourceRecord -ZoneName test.com|ConvertTo-Json
  •                                                        ~~~~~~~~~~~~~~ 
    
    • CategoryInfo : NotSpecified: (:) [ConvertTo-Json], OutOfMemoryException
    • FullyQualifiedErrorId : System.OutOfMemoryException,Microsoft.PowerShell.Commands.ConvertToJsonCommand

What would be the solution to this problem? I need the data in json format only, since I have my project written based on parsing the data.

If anyone has a better solution to this, please let me know. Thanks in advance.

Windows for home | Other | Performance and system failures

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2022-08-22T14:36:25+00:00

Hi, my name is Anderson Souza, I hope I can help you with your issue.

I believe that your question will be better resolved if it is posted in a more suitable location such as the new Microsoft Q&A forum that is replacing the old TechNet. As it is a question aimed at infrastructure administrators that have more knowledge about the Microsoft enterprise technologies, I believe that you will get better results there, since this forum here is intended for home Windows users. Please, check the link below:

https://docs.microsoft.com/en-us/answers/products/

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2022-08-23T05:35:42+00:00

    Thank you, I will post it in Microsoft Q & A

    Was this answer helpful?

    0 comments No comments