I worked with the following PS1 script and was able to export the objects to csv:
$secpasswd = ConvertTo-SecureString "password" -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential ('username', $secpasswd)
$User = Invoke-RestMethod -Method 'Get' -uri "https://192.168.50.60/api/reports/v1/users" -Credential $Cred
$user.data | select-object 'user_name','email_id','user_status' | Export-Csv -path UserStatusTest2.csv -NoTypeInformation
The above script worked fine until I have limited users added in the table and CSV file had all the data. However when I increased the users, a blank CSV is getting created.
I tried Out-file and found that the out data is more than 2 MB in size and may be the cause of the issue. I don't know how to fix this. Please help