Can Get-DNSServer produce output in readable CSV or TXT and not XML?

Hello,
A Get-DNSServer -CN MyDC1 run from the console produces a nice formatted list of info to the console.  An export-csv of this same data gives me headings, but no data.  An Export-Clixml works, but I can view/use the data in this format.  Converting
xml to csv doesn't work as well.  A Format-List, then Out-File doesn't give me the data either.
Any suggestions on how I can get properly formatted CSV file with this output or at least, a Format-List to a text file?
Thanks for your help! SdeDot

You have to do a bit of finessing with the output objects to get it to look somewhat presentable. Here is one example of what I used:
Get-DnsServer -ComputerName DC1 | ForEach-Object {
[pscustomobject]@{
PSComputerName = $_.PSComputerName
ServerCache = ($_.ServerCache | Out-String).Trim()
ServerDiagnostics = ($_.ServerDiagnostics | Out-String).Trim()
ServerDsSetting = ($_.ServerDsSetting | Out-String).Trim()
ServerEdns = ($_.ServerEdns | Out-String).Trim()
ServerForwarder = ($_.ServerForwarder | Out-String).Trim()
ServerGlobalNameZone = ($_.ServerGlobalNameZone | Out-String).Trim()
ServerGlobalQueryBlockList = ($_.ServerGlobalQueryBlockList | Out-String).Trim()
ServerRecursion = ($_.ServerRecursion | Out-String).Trim()
ServerRootHint = ($_.ServerRootHint | Out-String).Trim()
ServerScavenging = ($_.ServerScavenging | Out-String).Trim()
ServerSetting = ($_.ServerSetting | Out-String).Trim()
ServerZone = ($_.ServerZone | Out-String).Trim()
ServerZoneAging = ($_.ServerZoneAging | Out-String).Trim()
ServerZoneScope = ($_.ServerZoneScope | Out-String).Trim()
} | Export-Csv -NoTypeInformation DNS.csv
You will also need to adjust the formatting on the spreadsheet to really present all of the data (expand the width on the columns), but it does end up working.
Boe Prox
Blog |
Twitter
PoshWSUS |
PoshPAIG | PoshChat |
PoshEventUI
PowerShell Deep Dives Book

Similar Messages

Maybe you are looking for

  • Use Automator to create new subfolders in a selected folder

    This seems like it should be easy to accomplish, but I have had no luck. I want to be able to select a folder, and then run an Automator Service to create a specific set of subfolders within the selected folder. I am able to set up automator to creat

  • Material description limitation on accept only English language

    Dear All, Is there any user exit / program which not allow user create material with Non English description in MM01? But we still need unicode support for system. we are facing export  material problem with external system out from company. thanks.

  • OJVM bug ??

    Hi, I found some discrepency on the results shown by memory profiler of JDEV (9.0.2) and that of NetBeans (IDE 4.0). Also, results of JDEV profiler is in contradiction to what Sun Java says (as per my own interpretation!). Here is what I am trying to

  • How does the Approvals process work in Oracle Hyperion Planning v 11.1.2

    Hi, I have recently upgraded to Oracle Hyperion Planning v 11.1.2 and the way that the application handles budget / Forecast approvals appears to have changed. Is anyone able to direct me to a user manual or provide me with some guidance on how to se

  • Problem displaying my form with Form9i

    Yep I got another problem with Form9i :/ The problem is when I try to execute my form, It doesn`t load my form but a form with an Oracle background...anyway nothaing related with the form that I expect to look at. PS: I start Oc4j instance before I l