The Meraki Community
Register or Sign in
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • About Taslim
Taslim

Taslim

Comes here often

Member since Sep 16, 2020

‎09-23-2020

Community Record

8
Posts
0
Kudos
0
Solutions

Badges

First 5 Posts View All
Latest Contributions by Taslim
  • Topics Taslim has Participated In
  • Latest Contributions by Taslim

Re: Automated password for Guest wireless user

by Taslim in Wireless LAN
‎09-19-2020 03:58 AM
‎09-19-2020 03:58 AM
Hi Gary,   Is there any script available to change the PSK if site network managed by configuration template, i tried with couple of change but not working. ... View more

Re: Automated password for Guest wireless user

by Taslim in Wireless LAN
‎09-19-2020 03:08 AM
‎09-19-2020 03:08 AM
    All good now its working as expected. Thanks lots ... View more

Re: Automated password for Guest wireless user

by Taslim in Wireless LAN
‎09-19-2020 02:40 AM
‎09-19-2020 02:40 AM
Hi Gary,     Change Output ================================= Change Wifi password Network Name :  XXXXXX id           :  N_XXXXXX Type         :  wireless SSID Name    :  XXXXX SSID#        :  1 Current PSK  :  k7fB37!oER#t$N New Password :  W$)c7uss4W Invoke-WebRequest : The remote server returned an error: (400) Bad Request. At C:\Users\Test\Desktop\MerakiPSKTool.ps1:55 char:7 +     $r = Invoke-WebRequest $request_uri -Method:Put -Headers $header_org -Body $jbo ... +          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebReques     t], WebException     + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCo     mmand   Password change failed for  + XXXXX +  at  + XXXXXX   Display output ============================== Displaying Wifi details Network Name :  XXXX id           :  N_XXXX Type         :  wireless SSID Name    :  XXXX SSID#        :  1 Current PSK  :  k7fB37!oER#t$N   ... View more

Re: Automated password for Guest wireless user

by Taslim in Wireless LAN
‎09-18-2020 07:03 PM
‎09-18-2020 07:03 PM
        param([string]$site=" changed according to us ",[string]$ssid="changed according to us",[string]$action="Display")    function sendMail([string]$txtbody)               {      #SMTP server name      $smtpServer = " changed according to us "        #Creating a Mail object      $msg = new-object Net.Mail.MailMessage        #Creating SMTP server object      $smtp = new-object Net.Mail.SmtpClient($smtpServer)        #Email structure      $msg.From = "merakiapi@ changed according to us "      $msg.To.Add("changed according to us ")                    $msg.subject = "New password for guest Wifi"      $msg.body = $txtbody                $msg.IsBodyHTML=$true        #Sending email      $smtp.Send($msg)               }   function Get-RandomCharacters($length, $characters)               {     $random = 1..$length | ForEach-Object { Get-Random -Maximum $characters.length }     $private:ofs=""     return [String]$characters[$random]               }   function Scramble-String([string]$inputString)               {         $characterArray = $inputString.ToCharArray()        $scrambledStringArray = $characterArray | Get-Random -Count $characterArray.Length         $outputString = -join $scrambledStringArray     return $outputString               }   function updateWiFiPSK ([string]$s_id, [string]$w_id, [string]$newpassword)               {               [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12                 # PSK = New password               $data = @{                              "psk" = $newpassword                              }                 #Convert data to Json format               $jbody = ConvertTo-Json -InputObject $data                 #Combine base URL and ssid               $request_uri = $base_uri + $networks_uri + $s_id + "/ssids/" + $w_id                             $r = Invoke-WebRequest $request_uri -Method:Put -Headers $header_org -Body $jbody                 return $r               }               function Get-SiteID     {     #get site id     $request_uri = $base_uri + $networks_uri     $r = Invoke-WebRequest $request_uri -Method:Get -Headers $header_org       $json = $r | ConvertFrom-Json     for($i=0;$i -lt $json.count;$i++)         {         if ($site -eq $json[$i].name)             {             Write-host "Network Name : " $json[$i].name             Write-host "id           : " $json[$i].id             Write-host "Type         : " $json[$i].type               $s_id = $json[$i].id             }         }       return $s_id     }   function Get-WiFiSSID ([string]$s_id)     {     #get wifi network ID from site requested     if ($s_id -ne "")         {         $request_uri = $base_uri + $networks_uri + $s_id + "/ssids/"         $r = Invoke-WebRequest $request_uri -Method:Get -Headers @{"X-Cisco-Meraki-API-Key"=" changed according to us "} -ContentType "application/json"           $z = $r | ConvertFrom-Json           for($i=0;$i -lt $z.count;$i++)             {                       If ($z[$i].name -eq $ssid)                 {                 Write-host "SSID Name    : " $z[$i].name                 Write-host "SSID#        : " $z[$i].number                 Write-host "Current PSK  : " $z[$i].psk                   $w_id = $z[$i].number                 }             }         }       return $w_id     }   function createPassword               {               $password = Get-RandomCharacters -length 4 -characters 'abcdefghiklmnoprstuvwxyz'               $password += Get-RandomCharacters -length 2 -characters 'ABCDEFGHKLMNOPRSTUVWXYZ'               $password += Get-RandomCharacters -length 2 -characters '1234567890'               $password += Get-RandomCharacters -length 2 -characters '!$%&()?}][{@#+'                      #Write-Host $password                                            return Scramble-String $password               }   # setup some global static stuff $base_uri = "https://nXX.meraki.com/api/v0/organizations/ changed according to us/ " ##    E.G.   n34.meraki.com/api/v0/organizations/<OrgID>/ $networks_uri = "networks/" #Meraki API KEY $api_key = " changed according to us " $header_org = @{"X-Cisco-Meraki-API-KEY" = $api_key;"Content-Type" = 'application/json'}   $s_id = "" $w_id = "" $mode = ""   If ($site -eq "" -or $ssid -eq "")     {     Write-Host "MerakiPSKTool - (c) 2019"     Write-Host ""     Write-Host "Site/SSID parameter is missing"     Write-Host "Usage: MerakiPSKTool.ps1 -site changed according to us -ssid changed according to us -action [Change | Display]"     Write-Host ""         exit     }   # if action not passed or is blank, set default mode to Display if ($action -eq "")     {     $action = "Display"     }   switch ($action)     {     {@("Display", "display") -contains $_ }         {             "Displaying Wifi details"             $mode = "display"         }         {@("Change", "change") -contains $_ }         {             "Change Wifi password"             $mode = "change"         }       default { "MerakiPSKTool.ps1" }     }     # get ID of the site passed in params (set a default value if no site passed) $s_id = Get-SiteID   If ($s_id -ne "")     {     # get id of Wifi network that password is to be changed for     $w_id = Get-WifiSSID($s_id)       #Write-Host "Site ID      : " $s_id " | Wifi #: " $w_id     }   if ($mode -eq "change")     {     # generate a new complex password     $newpassword = createPassword       $result = updateWiFiPSK $s_id $w_id $newpassword       #Write-Host $result                 # build email message body and send it     if ($result.StatusCode -eq 200)         {         Write-Host "Sending Email"           $txtbody = "<html><body>"         $txtbody = $txtbody + "The new password for " + $ssid + " at " + $site + " is<br><br><b><font size=30 color=green>"         $txtbody = $txtbody + $newpassword + "</font></b>"         $txtbody = $txtbody + "<br><br>If you have any problems please contact <SomeContactDetailsHere>"         $txtbody = $txtbody + "<br><br>regards<br>SignoffInfo"         $txtbody = $txtbody + "</body></html>"           #Write-Host $txtbody                                # send the email         sendMail $txtbody         }     else         {         Write-Host "Password change failed for " + $ssid + " at " + $site         }     } ... View more

Re: Automated password for Guest wireless user

by Taslim in Wireless LAN
‎09-18-2020 06:35 PM
‎09-18-2020 06:35 PM
Hi Nealgs,   Yaa i was missing / at the end of Base Uri, Now Display action working perfectly, however change action not working getting below error.   PS C:\Users\test\desktop> .\merakipsktool.ps1 Change Wifi password Network Name :  Name of network id           :  N_XXXXXX Type         :  wireless SSID Name    :  SSID Name SSID#        :  0 Current PSK  :  Nn!v5Gz)DHkvp=   Invoke-WebRequest : The remote server returned an error: (400) Bad Request. At C:\Users\test\desktop\MerakiPSKTool.ps1:55 char:7 +     $r = Invoke-WebRequest $request_uri -Method:Put -Headers $header_org -Body $jbo ... +          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc    eption     + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand   Password change failed for  + SSID Name +  at  + Name of Network PS C:\Users\test\desktop> ... View more

Re: Automated password for Guest wireless user

by Taslim in Wireless LAN
‎09-17-2020 07:19 PM
‎09-17-2020 07:19 PM
Hi Neagls,   First of all thanks to your all help.   I have set the API key and i am able to communicate the API, i tested through https://developer.cisco.com/meraki/api-v1/#!update-network-wireless-ssid.     ... View more

Re: Automated password for Guest wireless user

by Taslim in Wireless LAN
‎09-16-2020 07:27 PM
‎09-16-2020 07:27 PM
  Getting Below error, Please help.   + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (MerakiPSKTool.ps1:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException ... View more

Re: Automated password for Guest wireless user

by Taslim in Wireless LAN
‎09-16-2020 05:55 PM
‎09-16-2020 05:55 PM
HI Nealgs   I am not getting clear about update Get-WifiSSID value in script, please help on this ... View more
Powered by Khoros
custom.footer.
  • Community Guidelines
  • Cisco Privacy
  • Khoros Privacy
  • Privacy Settings
  • Terms of Use
© 2023 Meraki