Created
September 18, 2017 12:35
-
-
Save a73xsh/d6d01a1d9139de8c49a57da236ff1e02 to your computer and use it in GitHub Desktop.
Get VM on Vmware datastore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$report = @() | |
$VMs = Get-datastore | Where {$_.name -like '*DSName*' -or $_.name -like '*DSName*'} | Get-VM | |
Foreach ($VM in $VMs){ | |
$line = $VM | Select Name, @{N="vCPU";E={($_).NumCpu}}, @{N="Memory (GB)";E={($_).MemoryGB}}, @{N="Cluster";E={Get-Cluster -VM $_}}, @{N="Folder";E={$_.folder}}, @{N="Network";E={$_.Networkadapters.NetworkName}} | |
$report += $line | |
} | |
$report | Export-csv C:\temp\VMList.csv -NoTypeInformation -UseCulture |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment