public/Set-CTDateTime.ps1

#https://$($ip)/stw-cgi/system.cgi?msubmenu=date&action=set&TimeZoneIndex=$($sitetimezone)&DSTEnable=True
#https://$($ip)/stw-cgi/system.cgi?msubmenu=date&action=set&SyncType=NTP&NTPURLList=$($NTPServerIp),time.nist.gov

Function Set-CTDateTime {
    [cmdletBinding(
        #DefaultParameterSetName='All',
        #SupportsShouldProcess = $true,
        ConfirmImpact='high'
        )]
    Param(
        [Parameter(
            Mandatory=$true
            #ParameterSetName='All'
        )]
        [String]$IP,

        [Parameter(
            Mandatory=$true
            #ParameterSetName='All'
        )]
        [pscredential]$Credential,

        [Parameter(
            Mandatory=$false
            #ParameterSetName='All'
        )]
        [String]$NTPServers,

        [Parameter(
            Mandatory=$false
            #ParameterSetName='All'
        )]
        [switch]$DisableNTP

    )
    DynamicParam {
        $DynamicParameters = @{
            CameraType = @{
                Mandatory = $true
                #Position = 1
                #ParameterSetName = "All"
                Enum = $Script:SupportedCameraModels
            }

            TimeZone = @{
                Mandatory = $false
                #Position = 2
                #ParameterSetName = "All"
                Enum = $Script:HanwhaTimeZones.Keys
                Value = "UTC"
            }
        }

        return New-DynamicParameterSet -ParameterTable $DynamicParameters
    }
    Begin {
        Write-Debug "[Set-CTDateTime] Started"
        $CameraType = $PSBoundParameters.CameraType
        $TimeZone = $PSBoundParameters.TimeZone

        if($CameraType -eq 'Hanwha') {
            #Set basic Paramters for Invoke-HanwhaCommand
            $CamCmd = @{
                Arguments = @{
                    IP = $IP
                    Menu = 'system'
                    SubMenu = 'date'
                    Action = 'set'
                    Parameters = @()
                }
                Credential = $Credential
            }

            #Add Action Parameters
            if(!$TimeZone -and !$NTPServers -and !$DisableNTP) {
                Throw "Must set an option"
            }

            if($TimeZone) {
                $CamCmd.Arguments.Parameters += "TimeZoneIndex=$($HanwhaTimeZones[$TimeZone])"
                $CamCmd.Arguments.Parameters += "DSTEnable=$($TimeZone.Contains('DT'))"
            }

            if($NTPServers) {
                $CamCmd.Arguments.Parameters += "SyncType=NTP"
                $CamCmd.Arguments.Parameters += "NTPURLList=$NTPServers"
            }
            else {
                $CamCmd.Arguments.Parameters += "SyncType=Manual"
            }

            Invoke-HanwhaCommand @CamCmd
        }
    }
}