Functions/Generic/WANCommonInterfaceConfig.ps1
function Get-AvmWanLinkProperty { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanLinkProperty .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanLinkProperty .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:WANCommonInterfaceConfig:1#GetCommonLinkProperties" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/wancommonifconfig1" XmlResponse = "GetCommonLinkPropertiesResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmWanOnlineMonitor { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanOnlineMonitor .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanOnlineMonitor .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.String]$NewSyncGroupIndex ) $AvmWebrequestBody = [AvmBody]::new() $AvmWebrequestBody.SoapAction = "urn:dslforum-org:service:WANCommonInterfaceConfig:1" $AvmWebrequestBody.UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/wancommonifconfig1" $AvmWebrequestBody.Action = "X_AVM-DE_GetOnlineMonitor" $AvmWebrequestBody.InnerBody = "<s:NewSyncGroupIndex>{0}</s:NewSyncGroupIndex>" -f $NewSyncGroupIndex [System.Collections.Hashtable]$SplatParameters = @{ Insecure = $Insecure Url = $Url Port = $Port Credential = $Credential SoapAction = $AvmWebrequestBody.GenerateSoapAction() UrlPath = $AvmWebrequestBody.UrlPath Body = $AvmWebrequestBody.GenerateBody() XmlResponse = $AvmWebrequestBody.GenerateXmlResponse() } Connect-AvmDevice @SplatParameters } function Get-AvmWanTotalByteReceived { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanTotalByteReceived .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanTotalByteReceived .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:WANCommonInterfaceConfig:1#GetTotalBytesReceived" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/wancommonifconfig1" XmlResponse = "GetTotalBytesReceivedResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmWanTotalByteSent { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanTotalByteSent .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanTotalByteSent .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:WANCommonInterfaceConfig:1#GetTotalBytesSent" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/wancommonifconfig1" XmlResponse = "GetTotalBytesSentResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmWanTotalPacketReceived { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanTotalPacketReceived .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanTotalPacketReceived .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:WANCommonInterfaceConfig:1#GetTotalPacketsReceived" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/wancommonifconfig1" XmlResponse = "GetTotalPacketsReceivedResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmWanTotalPacketSent { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanTotalPacketSent .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmWanTotalPacketSent .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:WANCommonInterfaceConfig:1#GetTotalPacketsSent" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/wancommonifconfig1" XmlResponse = "GetTotalPacketsSentResponse" } Connect-AvmDevice @SplatParameters } function Set-AvmWanAccessType { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmWanAccessType .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmWanAccessType .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)] [ValidateSet("DSL","Ethernet")] [System.String]$NewAccessType ) $AvmWebrequestBody = [AvmBody]::new() $AvmWebrequestBody.SoapAction = "urn:dslforum-org:service:WANCommonInterfaceConfig:1" $AvmWebrequestBody.UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/wancommonifconfig1" $AvmWebrequestBody.Action = "X_AVM-DE_SetWANAccessType" $AvmWebrequestBody.InnerBody = "<s:NewAccessType>{0}</s:NewAccessType>" -f $NewAccessType [System.Collections.Hashtable]$SplatParameters = @{ Insecure = $Insecure Url = $Url Port = $Port Credential = $Credential SoapAction = $AvmWebrequestBody.GenerateSoapAction() UrlPath = $AvmWebrequestBody.UrlPath Body = $AvmWebrequestBody.GenerateBody() XmlResponse = $AvmWebrequestBody.GenerateXmlResponse() } Connect-AvmDevice @SplatParameters } |