NOTE : THIS IS NOT OFFICIAL SCRIPT FROM TINTRI
The Get-TintriVMVDiskStat cmdlet allows you to retrieve virtual disk statistics for a specified VM.
Here’s an example PowerShell script that demonstrates how you can use the Get-TintriVMVDiskStat cmdlet to retrieve disk statistics for multiple VMs and validate the results:
# Import the Tintri PowerShell module
Import-Module -Name Tintri
# Tintri server details
$TintriServer = "https://your-tintri-server"
$Credential = Get-Credential -Message "Enter your Tintri credentials"
# List of VMs to retrieve disk stats
$VMsToCheck = "VM1", "VM2", "VM3" # Add the names of VMs you want to check
# Loop through the VMs and retrieve disk stats
foreach ($VMName in $VMsToCheck) {
$VMStats = Get-TintriVMVDiskStat -Server $TintriServer -Credential $Credential -VMName $VMName
if ($VMStats) {
Write-Host "Disk statistics for VM: $VMName"
$VMStats | Format-Table -AutoSize
Write-Host ""
} else {
Write-Host "Failed to retrieve disk statistics for VM: $VMName"
}
}
Write-Host "Disk statistics retrieval completed."
In this script:
- Import the Tintri PowerShell module if it’s not already imported.
- Provide the Tintri server details and credentials.
- Specify the list of VMs you want to retrieve disk statistics for in the
$VMsToCheckarray. - Loop through the array and use the
Get-TintriVMVDiskStatcmdlet to retrieve disk statistics for each VM. - Display the retrieved statistics using the
Format-Tablecmdlet. - If the disk statistics retrieval fails for any VM, an error message is displayed.
Please note that the example above is based on the structure of how Tintri PowerShell cmdlets generally work. However, it’s important to refer to the official documentation for the most up-to-date information on using the Tintri PowerShell Toolkit and its cmdlets.