Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 523 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Powershell export-csv with no headers?

#1
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!
Reply

#2
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"

Reply

#3
Powershell 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'
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through