11-02-2023 08:54 AM
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 MerakiYou'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.
01-17-2024 10:53 AM
I think the problem is that as a hashtable it is not in JSON format.
Here is what is stored for the variable but that is not the right format.
PS > $SSIDConfig
{"enabled":"True","ipAssignmentMode":"NAT Mode","encryptionMode":"wpa","wpaEncryptionMode":"WPA3 Transition Mode","name":"Test","authMode":"psk","psk":"TestTest1","lanIsolationEnabled":"False","bandSelection":"Dual band operation"}
Should look something like this:
{"Attributes":[],"File":null,"IsFilter":false,"IsConfiguration":false,"Module":null,"StartPosition":{"Content":"{name:Test,enabled:True,authMode:psk,psk:TestTest1,encryptionMode:wpa,wpaEncryptionMode:WPA3 Transition Mode,ipAssignmentMode:NAT Mode,bandSelection:Dual band operation,lanIsolationEnabled:False}","Type":19,"Start":14,"Length":205,"StartLine":1,"StartColumn":15,"EndLine":1,"EndColumn":220},"DebuggerHidden":false,"Id":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","Ast":{"Attributes":[],"UsingStatements":[],"ParamBlock":null,"BeginBlock":null,"ProcessBlock":null,"EndBlock":{"Unnamed":true,"BlockKind":130,"Statements":"name:Test,enabled:True,authMthMode:psk,psk:TestTest1,encryptionMode:wpa,wpaEncryptionMode:WPA3 Transition Mode,ipAssignmentMode:NAT Mode,bandSelection:Dual band operation,lanIsolationEnabled:False","Parent":"{name:Test,enabled:True,authMode:psk,psk:TestTest1,encryptionMode:wpa,wpaEncryptionMode:WPA3 Transition Mode,ipAssignmentMode:NAT Mode,bandSelection:Dual band operation,lanIsolationEnabled:False
01-17-2024 10:56 AM
but what exactly are you trying to update? Details please.
01-17-2024 12:19 PM
I am trying to use PowerShell to update 170 Meraki Network SSIDs.
01-17-2024 11:39 AM
Hi DarkStar! Thanks for trying out my module. It's still a bit of a work in progress and the thing I'm lacking the most is solid documentation with functional & tested examples. Keep in mind that depending on the device you may need to use Set-MerakiNetworkApplianceSSID instead.
Try using a PSCustomObject and converting it to compressed JSON. It just worked for me:
$SSIDConfig = [PSCustomObject]@{
name = "Test"
enabled = $true
authMode = "psk"
psk = "TestTest1"
encryptionMode = "wpa"
wpaEncryptionMode = "WPA3 Transition Mode"
ipAssignmentMode = "NAT Mode"
bandSelection = "Dual band operation"
lanIsolationEnabled = $false
}
$SSIDConfig = $SSIDConfig | ConvertTo-Json -Compress
Set-MerakiNetworkWirelessSSID -AuthToken $authtoken -NetworkId $NetID -Number 3 -SSIDConfig $SSIDConfig
01-17-2024 12:07 PM
I assumed the Set-MerakiNetworkApplianceSSID was for the Firewalls that have the WiFi built in?
01-17-2024 12:27 PM
I think you're correct about this one. I'm not the network guy in my org and i only have a z3 to test against
01-17-2024 12:08 PM
Tried the above code and I get:
The remote server returned an error: (400) Bad Request.
01-17-2024 12:16 PM
Here is the whole thing in case you see something wrong (Errors in RED):
PS > $SSIDConfig = [PSCustomObject]@{
>> name = "Test"
>> enabled = "True"
>> authMode = "psk"
>> psk = "TestTest1"
>> encryptionMode = "wpa"
>> wpaEncryptionMode = "WPA3 Transition Mode"
>> ipAssignmentMode = "NAT Mode"
>> bandSelection = "Dual band operation"
>> lanIsolationEnabled = "False"
>> }
PS > $SSIDConfig = $SSIDConfig | ConvertTo-Json -Compress
PS > Set-MerakiNetworkWirelessSSID -AuthToken "7xxxxxxxxxxxxxxxxxxx" -NetworkId "L_xxxxxxxxxxxxxxxxxxxxxx" -Number 2 -SSIDConfig $SSIDConfig
The remote server returned an error: (400) Bad Request.
PS > $SSIDConfig
{"name":"Test","enabled":"True","authMode":"psk","psk":"TestTest1","encryptionMode":"wpa","wpaEncryptionMode":"WPA3 Transition Mode","ipAssignmentMode":"NAT Mode","bandSelection":"Dual band operation","lanIsolationEnabled":"False"}
PS > Set-MerakiNetworkApplianceSSID -AuthToken "7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -NetworkId "L_^xxxxxxxxxxxxxxxxxxx" -Number 2 -SSIDConfig $SSIDConfig
Set-MerakiNetworkApplianceSSID : A parameter cannot be found that matches parameter name 'Number'.
At line:1 char:120
+ ... xxxxxx" -NetworkId "L_6xxxxxxxxx" -Number 2 -SSID ...
+ ~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-MerakiNetworkApplianceSSID], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Set-MerakiNetworkApplianceSSID
01-17-2024 12:24 PM
Try this one:
$SSIDConfig = [PSCustomObject]@{
name = "Test"
enabled = $true
authMode = "psk"
psk = "TestTest1"
encryptionMode = "wpa"
wpaEncryptionMode = "WPA3 Transition Mode"
ipAssignmentMode = "NAT Mode"
bandSelection = "Dual band operation"
lanIsolationEnabled = $false
}
The values for enabled and lanIsolationEnabled should be boolean ($true or $false).
The Set-MerakiNetworkApplianceSSID cmdlet does not recognize the -Number parameter. It’s possible that this cmdlet does not require or accept a -Number parameter, or the parameter might be named differently.
01-17-2024 01:15 PM
Darn, same error message using the boolean.
The remote server returned an error: (400) Bad Request.
01-17-2024 12:25 PM
sorry, I think this was a mistake on my end that I'll have to correct in a future version. For whatever reason, I used SSIDNumber for the parameter on the Set-MerakiNetworkApplianceSSID command and just number on the other one.
Set-MerakiNetworkApplianceSSID -AuthToken "7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -NetworkId "L_^xxxxxxxxxxxxxxxxxxx" -SSIDNumber 2 -SSIDConfig $SSIDConfig also in the SSIDConfig, try replacing "true" & "false" with $true and $false and then let the convertto-json do the work. I should really start copy and pasting more carefully haha
Edit: I just updated my earlier reply with that correction
01-17-2024 01:13 PM
IMHO
Set-MerakiNetworkApplianceSSID would not need a number there is only one SSID. MX65W is an example of a firewall with built in WiFi
Set-MerakiNetworkWirelessSSID should have numbers because there are many.
We have 170 networks so I have many many different firewalls and many different WAPs on the network. I will be more happy to help you debug this module. Thanks
01-17-2024 01:20 PM
Did changing the true/false syntax fix the issue for you?
I've only been able to test Set-MerakiNetworkApplianceSSID with my Z3, but it's capable of broadcasting multiple SSIDs, so the number is required for that command. I would love the help in testing this module though. please kick the tires and let me know what's not working. Might be easier to track if you submit issues to the github repo instead of this forum:
https://github.com/DocNougat/Meraki-Powershell-Module
01-17-2024 02:42 PM
@DocNougat I don't have a GitHub account, but I could set one up. However I have an idea. I am willing to send you FREE a firewall and 2 WAPs that you can keep and use however you like if that will help with the development of this module. I see a huge value for us. We manage a lot of networks and PowerShell commands would make our lives a lot easier. Thoughts ??
01-17-2024 01:19 PM
This command prompts for the number ....
Set-MerakiNetworkApplianceSSID -AuthToken "7xxxxxxxxxxxxxx" -NetworkId "L_6xxxxxxxxxxxxxxxxxxx" -SSIDConfig $SSIDConfig
cmdlet Set-MerakiNetworkApplianceSSID at command pipeline position 1
Supply values for the following parameters:
SSIDNumber:
I entered 0, 1, 2, 3 and 4 it then returns error message below:
Set-MerakiNetworkApplianceSSID : The remote server returned an error: (400) Bad Request.
At line:1 char:1
+ Set-MerakiNetworkApplianceSSID -AuthToken "7xxxxxxxxxxxxx ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Set-MerakiNetworkApplianceSSID
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide