Hi all,
I would like to know if there is any command that returns the number of disks that a VM has.
and also if there is any command to get and modify the number of IOPs of a disk.
Thanks in advance
Carlos
it will give you attached harddisks
Get-VM | Harddisk
it will give you count
get-vm | select name, @{N="TotalHDD"; E={($_ | Get-HardDisk).count }}
it is possible to retrieve number of IOPS of disk, but what do you mean by modifying it.
it will give you attached harddisks
Get-VM | Harddisk
it will give you count
get-vm | select name, @{N="TotalHDD"; E={($_ | Get-HardDisk).count }}
it is possible to retrieve number of IOPS of disk, but what do you mean by modifying it.
Hi kunaludapi,
It didn't work the output doesn't show the number of disks that my three VMs have. Below you can see both the script and the output. The test.txt file has the name of my three VMs.
What I mean by modifying number of IOPs is the following. In Vcenter when you edit the settings of any VM, if you click on the tab Resources you will see "Disk" and if you click on it. you will see the Disks that VMs have and right there you can limit the number of IOPs.
I would like to create a script that modifies that number since I have like 300 VM running and would be much faster just running a scrip than doing it manually.
$file = "C:\Users\cperalta_labs\Desktop\test.txt"
$vms = Get-Content $file
Get-VM $vms | Harddisk
get-vm $vms | select name, @{N="TotalHDD"; E={($_ | Get-HardDisk).count }}
Output:
Name TotalHDD
---- --------
cperalta (7e327337-51db-42d8-9cd8-c4...
cperalta (94af0cca-4480-42e6-84a8-ca...
cperalta-test (795ab623-0657-40f7-8f...
This is strange, no output on Get-VM | Get-Harddisk.
You can use below commands to get and set IOPS details on per vm
Get-VMResourceConfiguration
Set-VMResourceConfiguration
As I am assuming vms are deployed using vcloud director as there is UUID in the name.
If yes try loggging into vcloud director using Connect-CIServer and let me know what output do you see.
Get-CIVM | Get-CIVMHardDisk
Thank you very much. I already made this command work... get-vm $vms | select name, @{N="TotalHDD"; E={($_ | Get-HardDisk).count }}
I have a question what do N and E mean ?? or where can I find a doc that explains that, do you know.
thanks again
This is very basic and will help you.
Windows PowerShell Tip: Using Calculated Properties