<# .SYNOPSIS A short one-line action-based description, e.g. 'Tests if a function is valid' .DESCRIPTION Create a new snapshot of a VMware Virtual Machine .NOTES Create a new snapshot of a VMware Virtual Machine .LINK Specify a URI to a help page, this will show when Get-Help -Online is used. .EXAMPLE New-ITDVMwareVMSnapshot -VMName itdwinautot1.nd.gov -Name "Before Upgrade to 7.0U3k" -Description "Before Upgrade, delete after 3/3/2023" #> function New-ITDVMwareVMSnapshotV3 { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string[]] $VMName, [Parameter(Mandatory = $true)] [string] $Name, [string] $Description, [switch] $Memory ) begin { } process { ForEach ($VName in $VMName) { $VM = Get-VM -Name $VName | Where-Object { $_.ExtensionData.summary.config.ManagedBy.Type -ne "placeholderVm" } $NewSnapshotParams = @{ Name = $Name; RunAsync = $true; } switch ($PSBoundParameters.Keys) { Description { $NewSnapshotParams.Description = $Description } Memory { $NewSnapshotParams.Memory = $Memory; $NewSnapshotParams.RunAsync = $false; } } $NewSnapshotParams $VM | New-Snapshot @NewSnapshotParams } } end { } }