HI All,
my first time here, hello everyone 🙂
i am reaching out to the community to get help on the following powershell syntax that is causing me a sight headache. i just want to get very basic information and take it from there but getting some errors. i have used snippets found from here: https://github.com/ronfowler/merakiapi
code:
$merakiAPI = "https://dashboard.meraki.com/api/v0"
$headers = @{
"X-Cisco-Meraki-API-Key" = "XXXXX"
"Content-Type" = "application/json"
}
$uriStem = "/organizations"
$uri = "$($merakiAPI)$($uriStem)"
#Write-Host "GET - $($uri)"
$response = Invoke-WebRequest -Method Get -Uri $uri -Headers $headers
Error:
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
any idea what i am doing incorrectly here any help would be awesome 🙂
thank you in advance,
Dan
Solved! Go to solution.
My scripts all started failing a week ago (ish) as well. There was a sticky post about the Meraki TLS change to the top of this board, but it didn't contain the PS fix.
Try adding the below code to the top of your script:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Once I added this, it forced the connection to use TLS 1.2 and my API calls succeeded.
I don't see anything immediately obvious. Is it throwing a specific error? Have you tried using Postman, it is free and helps design your queries and see responses a little more easily. You can also export queries in different code formats like Python etc...
My scripts all started failing a week ago (ish) as well. There was a sticky post about the Meraki TLS change to the top of this board, but it didn't contain the PS fix.
Try adding the below code to the top of your script:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Once I added this, it forced the connection to use TLS 1.2 and my API calls succeeded.
The Powershell service doesn't support negotiating to a stronger cipher suite? I'm amazed!!!
It should support upgrading to stronger crypto without needing a code change.
You're not wrong. My preference would be to start at the strongest cipher first and iterate it's way down to the weakest. I found a blog post or two regarding ways to work the snippet I posted above into the local PS profile itself, but when you have automation servers that are changing frequently, or ones that you don't manage, it's a real pain to mess with that.
thank you everyone. seems the issues with tls thanks community 🙂