$Allvms = Get-View -ViewType “VirtualMachine” -filter @{”Guest.GuestState”=”^running$”}
In vCloud, I can use the below, but not sure it's completely accurate, but it should doGet-CIVM -Status "PoweredOn" | Select Name
Then in the old script I checked if the VM was a Windows guestIf ($($vm.Guest.GuestFamily) -eq "windowsGuest") {
so it seems I can use thisIf ($vm.GuestOSFullName -Like "Microsoft Windows*") {
Now comes the hard part....for me at least....I can't find a way to dig into the Guest properties, specifically the disk statistics. In the old script I used$Drives = $vm.Guest.Disk
ForEach ($DriveC in $drives) {
#Calculations
$Freespace = [math]::Round($DriveC.FreeSpace / 1MB)
$Capacity = [math]::Round($DriveC.Capacity / 1MB)
$SpaceOverview = "$Freespace" + "/" + "$capacity"
$PercentFree = [math]::Round(($FreeSpace)/ ($Capacity) * 100)
$Disk = $DriveC.DiskPath.Substring(0,2)
}
I've seen some code to invoke a web request to the vCloud API, but what I found provides total capacity, and not used space in the guest disk.Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.