Hi,
I am unable to get the CSV output for below as I the csv output shows
Length
"24"
"36"
Please help
$dCenter = "MyDC"
$cluster = "Compute"
$clusterInfo = Get-Datacenter -Name $dCenter | get-cluster $cluster
$vmHosts = $clusterInfo | get-vmhost | select -ExpandProperty Name
$RDMNAAs = $clusterInfo | Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select -ExpandProperty ScsiCanonicalName -Unique
$RDMNAAs | Export-CSV -Path ".\RDMs.csv" -NoTypeInformation -UseCultur
Try something like this
$RDMNAAs = $clusterInfo | Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select -Property ScsiCanonicalName -Unique
$RDMNAAs |
ConvertTo-Csv -NoTypeInformation |
Select-Object -Skip 1 |
Set-Content -Path ".\RDMs.csv"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you try with
Select -Property ScsiCanonicalName -Unique
instead of
Select -ExpandProperty ScsiCanonicalName -Unique
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
I tried as below, it worked. but I dont need header. how can I get the output without header in CSV
Select -Property ScsiCanonicalName -Unique
Try something like this
$RDMNAAs = $clusterInfo | Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select -Property ScsiCanonicalName -Unique
$RDMNAAs |
ConvertTo-Csv -NoTypeInformation |
Select-Object -Skip 1 |
Set-Content -Path ".\RDMs.csv"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That worked perfect :)...Thank you very much