Public/Get-MerakiNetworkSwitchAccessPolicies.ps1
function Get-MerakiNetworkSwitchAccessPolicies { <# .SYNOPSIS Retrieves the access policies for a Meraki switch network. .DESCRIPTION This function retrieves the access policies configured for a Meraki switch network. It requires a valid Meraki API token and the ID of the network for which the access policies are to be retrieved. .PARAMETER AuthToken The Meraki API token to use for the request. .PARAMETER networkId The ID of the network for which the access policies are to be retrieved. .EXAMPLE PS C:\> Get-MerakiNetworkSwitchAccessPolicies -AuthToken "1234" -networkId "N_1234567890" This example retrieves the access policies for the network with ID "N_1234567890" using the Meraki API token "1234". .NOTES For more information about the Meraki Dashboard API, visit https://developer.cisco.com/meraki/api-v1/. #> [CmdletBinding()] param ( [parameter(Mandatory=$true)] [string]$AuthToken, [parameter(Mandatory=$true)] [string]$networkId ) try { $header = @{ "X-Cisco-Meraki-API-Key" = $AuthToken } $response = Invoke-RestMethod -Method Get -Uri "https://api.meraki.com/api/v1/networks/$networkId/switch/accessPolicies" -Header $header -UserAgent "MerakiPowerShellModule/1.0.2 DocNougat" return $response } catch { Write-Error "An error occurred while retrieving the access policies: $_" } } |