on this script we’ll use the some PowerCli Cmdlets we already showed before .
this script we’ll show you the folders on your connected VC ,and then will ask you to choose for one of them
so it’ll go and scan VM’s inside the chosen folder for Disk Drives installed and their sizes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
CLS $Folders = Get-Folder -Type VM Write-Host "Select from Current folder list" -BackgroundColor Black -ForegroundColor White Write-Host ($Folders) -BackgroundColor Black -ForegroundColor Green -Separator "," $FolderName = Read-Host "Folder Name?" try { $ServerFile = get-folder -Name $FolderName -ErrorAction Stop | Get-VM | Select Name $objDetails = @() foreach ($Server in $ServerFile) { $ServerName = $Server.Name $DiskSize = Get-HardDisk -VM $ServerName | Select -ExpandProperty CapacityGB $Collector = New-Object System.Object $Collector | Add-Member -type NoteProperty -Name Server -Value $ServerName $Collector | Add-Member -type NoteProperty -Name CountDrives -Value $DiskSize.Count $Collector | Add-Member -type NoteProperty -Name DiskSize -Value $DiskSize $objDetails += $Collector } $objDetails } catch {Write-Host "NO Folder Existing with Name $FolderName"} |
(Visited 2,163 times, 1 visits today)