Functions/Generic/LANHostConfigManagement.ps1
function Enable-AvmLanDhcpServer { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Enable-AvmLanDhcpServer .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Enable-AvmLanDhcpServer .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()] [System.Byte][System.Boolean]$NewDHCPServerEnable = 0 ) $AvmWebrequestBody = [AvmBody]::new() $AvmWebrequestBody.SoapAction = "urn:dslforum-org:service:LANHostConfigManagement:1" $AvmWebrequestBody.UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" $AvmWebrequestBody.Action = "SetDHCPServerEnable" $AvmWebrequestBody.InnerBody = "<s:NewDHCPServerEnable>{0}</s:NewDHCPServerEnable>" -f $NewDHCPServerEnable [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-AvmLanAddressRange { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanAddressRange .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanAddressRange .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:LANHostConfigManagement:1#GetAddressRange" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" XmlResponse = "GetAddressRangeResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmLanDnsServer { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanDnsServer .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanDnsServer .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:LANHostConfigManagement:1#GetDNSServers" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" XmlResponse = "GetDNSServersResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmLanManagementInfo { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanManagementInfo .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanManagementInfo .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:LANHostConfigManagement:1#GetInfo" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" XmlResponse = "GetInfoResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmLanNumberOfEntry { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanNumberOfEntry .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanNumberOfEntry .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:LANHostConfigManagement:1#GetIPInterfaceNumberOfEntries" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" XmlResponse = "GetIPInterfaceNumberOfEntriesResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmLanRouterList { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanRouterList .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanRouterList .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:LANHostConfigManagement:1#GetIPRoutersList" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" XmlResponse = "GetIPRoutersListResponse" } Connect-AvmDevice @SplatParameters } function Get-AvmLanSubnetMask { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanSubnetMask .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Get-AvmLanSubnetMask .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:LANHostConfigManagement:1#GetSubnetMask" UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" XmlResponse = "GetSubnetMaskResponse" } Connect-AvmDevice @SplatParameters } function Set-AvmLanAddressRange { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmLanAddressRange .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmLanAddressRange .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.Net.IPAddress]$NewMinAddress, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.Net.IPAddress]$NewMaxAddress ) $AvmWebrequestBody = [AvmBody]::new() $AvmWebrequestBody.SoapAction = "urn:dslforum-org:service:LANHostConfigManagement:1" $AvmWebrequestBody.UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" $AvmWebrequestBody.Action = "SetAddressRange" $AvmWebrequestBody.InnerBody = @" <s:NewMinAddress>{0}</s:NewMinAddress> <s:NewMaxAddress>{1}</s:NewMaxAddress> "@ -f $NewMinAddress, $NewMaxAddress [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 Set-AvmLanInterfaceIp { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmLanInterfaceIp .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmLanInterfaceIp .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()] [System.Byte][System.Boolean]$NewEnable = 1, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.String]$NewIPAddress, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.String]$NewSubnetMask, [Parameter()] [System.String]$NewIPAddressingType = "Static" ) $AvmWebrequestBody = [AvmBody]::new() $AvmWebrequestBody.SoapAction = "urn:dslforum-org:service:LANHostConfigManagement:1" $AvmWebrequestBody.UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" $AvmWebrequestBody.Action = "SetIPInterface" $AvmWebrequestBody.InnerBody = @" <s:NewEnable>{0}</s:NewEnable> <s:NewIPAddress>{1}</s:NewIPAddress> <s:NewSubnetMask>{2}</s:NewSubnetMask> <s:NewIPAddressingType>{3}</s:NewIPAddressingType> "@ -f $NewEnable, $NewIPAddress, $NewSubnetMask, $NewIPAddressingType [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 Set-AvmLanSubnetMask { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmLanSubnetMask .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmLanSubnetMask .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]$NewSubnetMask ) $AvmWebrequestBody = [AvmBody]::new() $AvmWebrequestBody.SoapAction = "urn:dslforum-org:service:LANHostConfigManagement:1" $AvmWebrequestBody.UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" $AvmWebrequestBody.Action = "SetSubnetMask" $AvmWebrequestBody.InnerBody = "<s:NewSubnetMask>{0}</s:NewSubnetMask>" -f $NewSubnetMask [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 Set-AvmRouterIp { <# .SYNOPSIS Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmRouterIp .DESCRIPTION Wiki: https://github.com/Gincules/avmtools/wiki/Set-AvmRouterIp .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]$NewIPRouters ) $AvmWebrequestBody = [AvmBody]::new() $AvmWebrequestBody.SoapAction = "urn:dslforum-org:service:LANHostConfigManagement:1" $AvmWebrequestBody.UrlPath = "$(if ($RemoteAccess) { "/tr064" })/upnp/control/lanhostconfigmgm" $AvmWebrequestBody.Action = "SetIPRouter" $AvmWebrequestBody.InnerBody = "<s:NewIPRouters>{0}</s:NewIPRouters>" -f $NewIPRouters [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 } |