Functions/Snapshots.psm1

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
29
30
function Remove-Snap {
    <#
        .SYNOPSIS
            Remove vmware snapshots with confirmation screen
        .EXAMPLE
            rmsnap *b2b*
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory=$true, ValueFromPipeline = $true)]
        [ValidateNotNullOrEmpty()]
        [string]$VM
    )
    
    Get-VM $VM | Get-Snapshot | %{($_|select VM,Name,Created,SizeGB|fl); Remove-Snapshot -RunAsync $_}

}

function Get-Snap {
    <#
        .SYNOPSIS
            Show vmware snapshots
        .EXAMPLE
            getsnap
    #>

    
    Get-Snapshot -vm * | select vm,created,name,description | Sort-Object Created

}