private/Functions/Hanwha/Set-HanwhaDNSSettings.ps1

#https://$($ip)/stw-cgi/network.cgi?msubmenu=dns&action=set&Type=Manual&PrimaryDNS=10.119.3.254&SecondaryDNS=10.119.3.254

Function Set-HanwhaDNSSettings {
    [cmdletBinding()]
    Param(
        [Parameter()]
        [hashtable]$Object
    )
    
    <#
    Object Definition:
    @{
        IP = [String(Mandatory)]
        Credential = [PSCredential(Mandatory)]
        PrimaryDNS = [String(Optional)]
        SecondaryDNS = [String(Optional)]
        DNSType = [String(Optional)]
    }
    #>


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

    #Add Action Parameters
    $CamCmd.Arguments.Parameters += "Type=$($Object.DNSType)"

    if($Object.DNSType -eq 'Manual') {
        $CamCmd.Arguments.Parameters += "PrimaryDNS=$($Object.PrimaryDNS)"
        $CamCmd.Arguments.Parameters += "SecondaryDNS=$($Object.SecondaryDNS)"
    }

    Invoke-HanwhaCommand @CamCmd
}