Afternoon All
Up until yesterday, the script below (adjusted to project my API & SIte only) worked to generate a new password for one of our SSID's and change it via the API.
Set-ExecutionPolicy Bypass -scope Process -Force
#Install-Module -Name PSSharedGoods -RequiredVersion 0.0.155
#Meraki API KEY
$api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#Meraki Network URL
$network_id = "L_xxxxxxxxxxxxxxxxx"
#Base API URL
$api = @{
}
#API URL for SSID PSK Change XXX
$api_put = @{
}
# Word list
$words = @('rabbit', 'peccary', 'colt', 'anteater',
'meerkat', 'eagle', 'owl', 'cow', 'turtle', 'bull',
'baselisk', 'snake', 'lizzard', 'panda', 'bear', 'pig',
'lion', 'tiger', 'bunny', 'wolf', 'deer', 'pronghorn',
'fish', 'rabbit', 'gorilla', 'puma', 'mustang', 'sheep',
'wolverine', 'hyena', 'beaver', 'rooster', 'ox', 'frog'
)
# Definition of funtion named "Create-Words"
Function Create-Words {
$word1 = "ABC"
$word2 = Get-Random -InputObject $words # get second random word from word list
$word3 = Get-RandomCharacters -length 1 -characters 'ABCDEFGHKLMNOPRSTUVWXYZ'
$word4 = Get-RandomCharacters -length 1 -characters 'abcdefghiklmnoprstuvwxyz'
$word5 = Get-RandomCharacters -length 2 -characters '1234567890'
$word6 = Get-RandomCharacters -length 1 -characters '!$%&()?}][{@#+'
$script:newWord = "$word1$word2$word3$word4$word5$word6" # combine word1 with word2 / delimiter = "-""
}
$newWord =""
# Execution of function "Create-Words"
Create-Words
# Output of new generated word in script
$newWord
$header_org = @{
"X-Cisco-Meraki-API-Key" = $api_key
"Content-Type" = 'application/json'
}
# PSK = New password
$data = @{
"psk" = $newWord
}
#Convert data to Json format
$jbody = ConvertTo-Json -InputObject $data
#URL Network_ID and SSID number
$api.ssid = "/networks/$network_id/wireless/ssids/6"
#Combine base api_put URL and $api.ssid
$Merakiuri = $api_put.endpoint + $api.ssid
#Invoke-RestMethod -Method Put -Uri $Merakiuri -Headers $header_org -Body $jbody | Out-Null
Not sure what has changed, but today it's not working. No error messages are coming up - it just doesn't do anything.
Does anyone have any ideas or suggestions?