I have recently started using powershell and struggling to achieve something. I am calling an API in my powershell script, and the output is a list of reports, where each report has a set of properties like reportID, reportname, workspaceId etc. I need to export this entire output to csv in a proper table format, and also export only one property (workspaceId) of each report to another csv file.
If someone is aware of how to do this, please help.
Below is a part of my script:
$reports = Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/admin/reports?$top=10' -Method Get
$reports | Out-File -Path "D:\2709\PS4.csv"