<#####
.SYNOPSIS
    Creates a vCenter scheduled task that will create a virtual machine snapshot.
.DESCRIPTION
    Creates a vCenter scheduled task that will create a virtual machine snapshot.  2506091114
.NOTES
    
.LINK
    https://northdakota.service-now.com/kb_view.do?sysparm_article=KB0017146
#>

[CmdletBinding()]
param (
    [Parameter(
        Mandatory = $true,
        HelpMessage = "The VMware virtual machine name.  This is most commonly the FQDN.  You can verify the virtual machine name by logging into vCenter.  Multiple entries can be submitted if the field loses focus, and you go back to it.  For example, after each entry hit Tab, then Shift-Tab back."
    )]
    [string[]]
    $VMName = $null,

    [Parameter(Mandatory = $true,
        HelpMessage = "The DateTime you want the snapshot to occur.")]
    [datetime]
    $DateTime = (Get-Date),

    [Parameter(Mandatory = $true,
        HelpMessage = "How many hours the snapshot will exist.  The snapshot will be automatically deleted after the duration.  Maximum value is 72 hours.")]
    [ValidateRange(1, 72)]
    [int]
    $DurationHours = 4,

    [Parameter(HelpMessage = "Email address that you want vCenter to notify when the snapshot is taken.  Multiple entries can be submitted if the field loses focus, and you go back to it.  For example, after each entry hit Tab, then Shift-Tab back.")]
    [string[]]
    $Email = $null
)

Write-Warning -Message ("Creating new snapshot " + (Get-Date) )