Functions/Generic/LANEthernetInterfaceConfig.ps1
function Enable-AvmLanInterface { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Enable-AvmLanInterface .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Enable-AvmLanInterface .NOTES Author: Gincules Website: https://github.com/Gincules/avmtools License: https://github.com/Gincules/avmtools/blob/main/LICENSE .LINK https://github.com/Gincules/avmtools https://github.com/Gincules/avmtools/blob/main/LICENSE #> Param ( [Alias("i")] [Parameter()] [System.Management.Automation.SwitchParameter]$Insecure = $false, [Alias("r")] [Parameter()] [System.Management.Automation.SwitchParameter]$RemoteAccess = $false, [Alias("u")] [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.String]$Url, [Alias("p")] [Parameter(Mandatory)] [ValidateRange(0,65535)] [System.UInt16]$Port, [Alias("c")] [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential]$Credential, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.Byte][System.Boolean]$NewEnable ) $AvmWebrequestBody = [AvmBody]::new() $AvmWebrequestBody.SoapAction = "urn:dslforum-org:service:LANEthernetInterfaceConfig:1" $AvmWebrequestBody.UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanethernetifcfg" $AvmWebrequestBody.Action = "SetEnable" $AvmWebrequestBody.InnerBody = "<s:NewEnable>{0}</s:NewEnable>" -f $NewEnable [System.Collections.Hashtable]$SplatParameters = @{ Insecure = $Insecure Url = $Url Port = $Port Credential = $Credential Body = $AvmWebrequestBody.GenerateBody() SoapAction = $AvmWebrequestBody.GenerateSoapAction() UrlPath = $AvmWebrequestBody.UrlPath XmlResponse = $AvmWebrequestBody.GenerateXmlResponse() } Connect-AvmDevice @SplatParameters } function Get-AvmLanInterfaceInfo { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanInterfaceInfo .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanInterfaceInfo .NOTES Author: Gincules Website: https://github.com/Gincules/avmtools License: https://github.com/Gincules/avmtools/blob/main/LICENSE .LINK https://github.com/Gincules/avmtools https://github.com/Gincules/avmtools/blob/main/LICENSE #> Param ( [Alias("i")] [Parameter()] [System.Management.Automation.SwitchParameter]$Insecure = $false, [Alias("r")] [Parameter()] [System.Management.Automation.SwitchParameter]$RemoteAccess = $false, [Alias("u")] [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.String]$Url, [Alias("p")] [Parameter(Mandatory)] [ValidateRange(0,65535)] [System.UInt16]$Port, [Alias("c")] [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential]$Credential ) [System.Collections.Hashtable]$SplatParameters = @{ Insecure = $Insecure Url = $Url Port = $Port Credential = $Credential SoapAction = "urn:dslforum-org:service:LANEthernetInterfaceConfig:1#GetInfo" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanethernetifcfg" XmlResponse = "GetInfoResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmLanStatistic { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanStatistic .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanStatistic .NOTES Author: Gincules Website: https://github.com/Gincules/avmtools License: https://github.com/Gincules/avmtools/blob/main/LICENSE .LINK https://github.com/Gincules/avmtools https://github.com/Gincules/avmtools/blob/main/LICENSE #> Param ( [Alias("i")] [Parameter()] [System.Management.Automation.SwitchParameter]$Insecure = $false, [Alias("r")] [Parameter()] [System.Management.Automation.SwitchParameter]$RemoteAccess = $false, [Alias("u")] [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.String]$Url, [Alias("p")] [Parameter(Mandatory)] [ValidateRange(0,65535)] [System.UInt16]$Port, [Alias("c")] [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.Management.Automation.PSCredential]$Credential ) [System.Collections.Hashtable]$SplatParameters = @{ Insecure = $Insecure Url = $Url Port = $Port Credential = $Credential SoapAction = "urn:dslforum-org:service:LANEthernetInterfaceConfig:1#GetStatistics" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanethernetifcfg" XmlResponse = "GetStatisticsResponse" } Connect-AvmDevice @SplatParameters } |