1

I have created a script which collected the VM counts for the selective folders in each Vcenter, This scripts seems working fine but it's not collecting output to the CSV.

$output = @()
Get-Content -Path C:\capacity_donot_delete\folder.txt | %{
  New-Object PSObject -Property @{
    Folder = $_
    VMCount = Get-Folder -Name $_ | Get-VM | Measure-Object | Select -ExpandProperty Count        
    }
}
$output | Export-Csv -Path C:\capacity_donot_delete\folder_count.csv -NoTypeInformation -UseCulture

Note: Also, I would like to make this script to generate a mail report whichever collected in the CSV.

Need support to fix this issue - Thanks in advance!!

BR/Subash.

Joseph Kern
  • 9,899
  • 4
  • 32
  • 56
suboss87
  • 109
  • 1
  • 2

0 Answers0