private/Functions/Axis/Set-AxisDateTime.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-HanwhDateTime {
    [cmdletBinding()]
    Param(
        [Parameter()]
        [hashtable]$Object
    )
    
    <#
    Object Definition:
    @{
        IP = [String(Mandatory)]
        Credential = [PSCredential(Mandatory)]
        TimeZone = [String(Optional)]
        NTPServers = [String(Optional)]
        DisableNTP = [switch(Optional)]
    }
    #>

    $Timezone = $false
    $NTPServers = $false
    $DisableNTP = $false

    if($Object.ContainsKey('TimeZone')) {
        $Timezone = $Object.Timezone
    }
    if($Object.ContainsKey('NTPServers')) {
        $NTPServers = $Object.NTPServers
    }
    if($Object.ContainsKey('DisableNTP')) {
        $DisableNTP = $Object.DisableNTP
    }

    #Set basic Paramters for Invoke-AxisCommand
    $CamCmd = @{
        Arguments = @{
            IP = $Object.IP
            Menu = 'system'
            SubMenu = 'date'
            Action = 'set'
            Parameters = @()
        }
        Credential = $Object.Credential
    }

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

    if($TimeZone) {
        $CamCmd.Arguments.Parameters += "TimeZoneIndex=$($AxisTimeZones[$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-AxisCommand @CamCmd
}