Public/Action/radio-state.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# # Copyright 2019, Alexis La Goutte <alexis dot lagoutte at gmail dot com> # # SPDX-License-Identifier: Apache-2.0 # function Set-ArubaIAPRadioState { <# .SYNOPSIS Set the radio state (on/off) of Aruba Instant AP .DESCRIPTION Configure Radio state (enable/disable for dot11a or dot11g) of Aruba Instant AP .EXAMPLE Set-ArubaIAPRadioState -dot11a -dot11g Enable dot11a and dot11g on IAP .EXAMPLE Set-ArubaIAPRadioState -dot11a:$false -dot11g:$false -iap_ip_addr 192.0.2.2 Disable dot11a and dot11g on IAP with address IP 192.0.2.2 #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] Param( [Parameter (Mandatory = $true)] [switch]$dot11a, [Parameter (Mandatory = $true)] [switch]$dot11g, [Parameter (Mandatory = $false)] [ipaddress]$iap_ip_addr = ${DefaultArubaIAPConnection}.iap_ip_addr ) Begin { } Process { $uri = "rest/radio-state" if ($dot11a -eq $true) { $dot11a_state = "no" } else { $dot11a_state = "yes" } if ($dot11g -eq $true) { $dot11g_state = "no" } else { $dot11g_state = "yes" } $radio_state = @{ "dot11a-radio-disable" = $dot11a_state "dot11g-radio-disable" = $dot11g_state } $body = @{ "iap_ip_addr" = $iap_ip_addr.ToString() "radio_state" = $radio_state } if ($PSCmdlet.ShouldProcess($iap_ip_addr, 'Set Radio State')) { $response = Invoke-ArubaIAPRestMethod -uri $uri -body $body -method 'POST' $response } } End { } } |