42 lines
988 B
PowerShell
42 lines
988 B
PowerShell
<#
|
|
.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 -ComputerName itdwinautot1.nd.gov -Name "Before Upgrade to 7.0U3k" -Description "Before Upgrade, delete after 3/3/2023"
|
|
#>
|
|
|
|
function Remove-ITDVMwareVMSnapshotV3 {
|
|
[CmdletBinding()]
|
|
param (
|
|
[string]
|
|
$ComputerName,
|
|
|
|
[string]
|
|
$Name
|
|
)
|
|
|
|
begin {
|
|
|
|
}
|
|
|
|
process {
|
|
|
|
$VM = Get-VM -Name $ComputerName | Where-Object { $_.ExtensionData.summary.config.ManagedBy.Type -ne "placeholderVm" }
|
|
|
|
$GetSnapshotParams = @{
|
|
Name = $Name
|
|
}
|
|
|
|
$VM | Get-Snapshot @GetSnapshotParams | Remove-Snapshot -Confirm:$false
|
|
}
|
|
|
|
end {
|
|
|
|
}
|
|
} |