cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
23487
Views
23
Helpful
42
Replies

Meraki PowerShell Module - All Endpoints

DocNougat
Community Member

Hi Everyone,

I got a little frustrated by the lack of any official PowerShell module for Cisco's Meraki products and the existing independently developed modules only have a fraction of the available endpoints. So to remedy this issue I wrote my own. I've been working on it on and off for a few months and I've finally reached a point that I'm considering the 1.0 release. There are 644 commands in total and I've been able to test a majority of the Get commands. The others I've had less opportunity to verify, but I have tested and used a few of them in production ready scripts. I'm still working on more detailed documentation, but in its current form it's ready for other humans to start playing with it and providing feedback.

I've published it to GitHub and the official PowerShell Gallery repository so you can install manually or simply by running the install command from an elevated PowerShell window:

Install-Module Meraki

You'll need an API key from your Meraki dashboard to get started.

Check the GitHub page for more information and usage examples:
Meraki PowerShell Module on GitHub

If anyone from Cisco is watching this thread, please send me free gear to validate my module with.


I'm already using this heavily in my own environment, but I'm looking for more people to test and provide feedback.

P.S. I'm #notTheNetworkGuy, I'm an IT Operations engineer and my job is largely focused on automating our environment. Nothing I've done here couldn't also have been easily accomplished with the existing Python library, but everything else in my mostly Windows-centric world is using PowerShell, so I made this to be able to write everything in the same language.

42 Replies 42

same issue if you include it in the command instead of entering it when prompted?
also, do did you try same thing with Set-MerakiNetworkWirelessSSID?

Two different messages:

Entering the number at the prompt:

Set-MerakiNetworkApplianceSSID : The remote server returned an error: (400) Bad Request.
At line:1 char:1
+ Set-MerakiNetworkApplianceSSID -AuthToken "7xxxxxxxxxxxxxxxxxx ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Set-MerakiNetworkApplianceSSID

With the value in the commend string:

Set-MerakiNetworkApplianceSSID : A parameter cannot be found that matches parameter name 'Number'.
At line:1 char:120
+ ... xxxxxxxxxxxxxx" -NetworkId "L_xxxxxxxxxxxxx2" -Number 0 -SSID ...
+                                                           ~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-MerakiNetworkApplianceSSID], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Set-MerakiNetworkApplianceSSID

If you're using Set-MerakiNetworkApplianceSSID you'll need to use -SSIDNumber

Set-MerakiNetworkApplianceSSID -AuthToken "7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -NetworkId "L_^xxxxxxxxxxxxxxxxxxx" -SSIDNumber 2 -SSIDConfig $SSIDConfig


If you're using Set-MerakiNetworkWirelessSSID you'll need to use -number

Set-MerakiNetworkWirelessSSID -AuthToken "7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -NetworkId "L_^xxxxxxxxxxxxxxxxxxx" -Number 2 -SSIDConfig $SSIDConfig

I'm going to publish an update to correct this soon (probably today or tomorrow)

Set-MerakiNetworkWirelessSSID

Gives the same error if prompted or in the comannd.

The remote server returned an error: (400) Bad Request.

What device are you testing this against?

We are using an MX65 Firewall with an MR57 WAP in the test enjoinment.

Actually I think I figured it out.
The Set-MerakiNetworkApplianceSSID endpoint doesn't support the following paremeters:
ipAssignmentMode
bandSelection
lanIsolationEnabled

https://developer.cisco.com/meraki/api-v1/update-network-appliance-ssid/

The Set-MerakiNetworkWirelessSSID works if I remove the following parameters.

ipAssignmentMode
bandSelection
lanIsolationEnabled

It supports them but removing them created the SSID on our network. So we are a lot closer.

Looks like LanIsolationEnabled is not in the Set-MerakiNetworkApplianceSSID creation list, and I have to have that command because these SSIDs cannot have access to the local LAN.

here is the return completed without error message:

number                       : 8
name                         : Test
enabled                      : True
splashPage                   : None
ssidAdminAccessible          : False
authMode                     : psk
psk                          : TestTest1
dot11w                       : @{enabled=False; required=False}
dot11r                       : @{enabled=False; adaptive=False}
encryptionMode               : wpa
wpaEncryptionMode            : WPA3 Transition Mode
ipAssignmentMode             : NAT mode
adultContentFilteringEnabled : False
dnsRewrite                   : @{enabled=False; dnsCustomNameservers=System.Object[]}
minBitrate                   : 11
bandSelection                : Dual band operation
perClientBandwidthLimitUp    : 0
perClientBandwidthLimitDown  : 0
perSsidBandwidthLimitUp      : 0
perSsidBandwidthLimitDown    : 0
mandatoryDhcpEnabled         : False
visible                      : True
availableOnAllAps            : True
availabilityTags             : {}
speedBurst                   : @{enabled=False}

I just published version 1.0.3 of the module. It corrects the examples in the help for each command to use the hashtable properly and also makes any command that requires a specified SSID take the parameter SSIDNumber instead of just number.

Also, if you're developing in visual studio code, try out my powershell module commander extension:
https://marketplace.visualstudio.com/items?itemName=DocNougat.powershell-commander

aleabrahao
Meraki Community All-Star
Meraki Community All-Star

I tested this on and worked for me.

# Define the API endpoint
$uri = "https://api.meraki.com/api/v1/networks/NETWORK_ID/wireless/ssids/SSID_NUMBER"

# Define the headers
$headers = @{
"X-Cisco-Meraki-API-Key" = "API_KEY"
"Content-Type" = "application/json"
}

# Define the body
$body = @{
name = "My SSID"
enabled = $true
authMode = "psk"
encryptionMode = "wpa"
psk = "PASSWORD"
wpaEncryptionMode = "WPA2 only"
dot11w = @{
enabled = $true
required = $false
}
} | ConvertTo-Json

try {
# Try sending the POST request
# Try sending the PUT request
$response = Invoke-RestMethod -Uri $uri -Method Put -Body $body -Headers $headers


# Output the response
$response
}
catch {
# Catch any exceptions and output details
Write-Host "Error: $_"
if ($_.Exception -ne $null) {
Write-Host "Exception Type: $($_.Exception.GetType().FullName)"
Write-Host "Exception Message: $($_.Exception.Message)"
if ($_.Exception.Response -ne $null) {
$responseStream = $_.Exception.Response.GetResponseStream()
$reader = New-Object System.IO.StreamReader($responseStream)
$responseText = $reader.ReadToEnd()
Write-Host "Response from server: $responseText"
}
}
}

I am not a Cisco employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.

I think I actually found the issue you're having. I dug a bit deeper into the API docs and it looks like the lanIsolationEnabled setting is only available if you set your ipAssignmentMode to "Bridge mode"(this is also case sensitive because 🤷🏻‍♂️). Here is an example I was able to run successfully with Set-MerakiNetworkWirelessSsid:
image.png