My script below.
How can I get this to have comma separated or Tab separated values and output to text file?
$myCol = @()
foreach ($cluster in Get-Cluster)
{
foreach($vmhost in ($cluster | Get-VMHost))
{
foreach($vm in (Get-VM -Location $vmhost)){
$VMView = $vm | Get-View
$VMSummary = "" | Select ClusterName,VMName,VMSockets,VMCores
$VMSummary.ClusterName = $cluster.Name
$VMSummary.VMName = $vm.Name
$VMSummary.VMSockets = $VMView.Config.Hardware.NumCpu
$VMSummary.VMCores = $VMView.Config.Hardware.NumCoresPerSocket
$myCol += $VMSummary
}
}
}
Data is in the variable $myCol but when I add the "Export-Csv C:\Temp\Test.txt" to the end, no data.
lol........duh the syntax is this....
$myCol | Export-Csv C:\Temp\Test.txt
lol........duh the syntax is this....
$myCol | Export-Csv C:\Temp\Test.txt