Add-PSSnapin VMware.VimAutomation.Core (For vSphere 5.5 or below)
Import-Module VMware.VimAutomation.Core (For vSphere 6.0 and above)
Connect-VIServer vCenterName
Get-Datastore | Select Name, @{N="NumberofVMs"; E={@($_ | Get-VM).count}} | Sort Name |Out-file "C:\Temp\VMcount.csv"
Import-Module VMware.VimAutomation.Core (For vSphere 6.0 and above)
Connect-VIServer vCenterName
Get-Datastore | Select Name, @{N="NumberofVMs"; E={@($_ | Get-VM).count}} | Sort Name |Out-file "C:\Temp\VMcount.csv"
Comments
Post a Comment