Is there a script that will give me list of virtual machines per a datastore. I want to list my datastores and then see how many virtual machines are on that datastore. It just needs to give me a number of VM's, not the names. Is this possible to do. We use Vsphere.
Try this
Get-Datastore | Select Name, @{N="VM#";E={($_ | Get-VM).Count}}
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I dont want to include our local storage and also our iscsi storage. The local storages names begin with the name storage and the iscsi storage names begins with iscsi, so I do not want to include these, how can I fit my where clause in this statement, do i use where {$_.name !match "iscsi..."}
If I understood it correctly this should do the trick
Get-Datastore | where {$_.Name -notlike "storage*" -and $_.Name -notlike "iscsi*"} | Select Name, @{N="VM#";E={($_ | Get-VM).Count}}
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference