Reply to Message

View discussion in a popup

Replying to:
richG
Contributor
Contributor

Hi Erik,

Ok here is my question that has been really bugging me. In this script below you can see $snap.SizeMB I am trying to figure out if there is a property for this. Now I did get this script off the web it does work but can not for the life of me figure out where this property is coming from.

Param ($age=30)

Connect-VIServer

$vm = Get-VM

$snapshots = Get-Snapshot -VM $vm

Write-Host -ForegroundColor Red "Old Snapshots Found"

foreach ($snap in $snapshots) {

if ($snap.created -lt (Get-Date).adddays(-$age)) {

Write-Host " VM: " $snap.VM, "Name: " $snap.Name, " Size: " $snap.SizeMB, " Created: " $snap.Created

}

}

another point I would love is if there was an easy switch for kb mb gb I know you can write a conversion to do it but lets face it how many folks want KB most of work in now a days either GB or TB let alone MB. Sorry had to sound off. Thanks for help much appreciated and yes I could us a cup of joe as well.

Reply
0 Kudos