So I'm trying to export a list of resources without the headers. Basically I need to omit line 1, "Name".
Here is my current code:
Get-Mailbox -RecipientTypeDetails RoomMailbox,EquipmentMailbox | Select-Object Name | Export-Csv -Path "$(get-date -f MM-dd-yyyy)_Resources.csv" -NoTypeInformation I've looked at several examples and things to try, but haven't quite gotten anything to work that still only lists the resource names.
Any suggestions? Thanks in advance!
2 Answers
It sounds like you basically want just text a file list of the names:
Get-Mailbox -RecipientTypeDetails RoomMailbox,EquipmentMailbox | Select-Object -ExpandProperty Name | Set-Content -Path "$(get-date -f MM-dd-yyyy)_Resources.txt" Edit: if you really want an export-csv without a header row:
(Get-Mailbox -RecipientTypeDetails RoomMailbox,EquipmentMailbox | Select-Object Name | ConvertTo-Csv -NoTypeInformation) | Select-Object -Skip 1 | Set-Content -Path "$(get-date -f MM-dd-yyyy)_Resources.csv" 7Powershell 7 is out now. Still no way to export-csv without headers. I get it. Technically it wouldn't be a CSV without a header row.
But I need to remove the header row, so
$obj | convertto-csv | select-object -skip 1 |out-file 'output.csv' P.S. I didn't need the quotes and I wanted to filter out rows based on a certain property value:
$obj | where-object {$_.<whatever property> -eq 'X' } | convertto-csv -usequotes never | select-object -skip 1 |out-file 'output.csv'