Skip to content
Clifra-Jones edited this page Aug 5, 2020 · 39 revisions

Welcome to the Meraki-API wiki!

Command Reference

Commands:

Set-MerakiAPI

  • Description: Save configuration information in the user profile.
  • Parameters:
    • APIKey: Meraki API Key
    • OrgID: Organizational ID

Get-MerakiOrganizations

  • Description: Retrieve the Organization information the user has access to.

  • Parameters:

    • APIKey: Meraki API Key

Get-MerakiNetworks

  • Description: Retrieve All networks in the Organization

Get-MerakiNetwork

  • Description: Retrieve a specific network
  • Parameters:
    • NetworkID: The ID of the network to retrieve

Get-MerakiNetworkDevices

  • Description: Retrieve all devices in a network.
  • Parameters:
    • id: Network ID
      • Accepts Pipeline input

Examples: Get devices in a specific network

Get-MerakiNetworkDevices -id N-XXXXXXXXXXXXXXX

Get-Devices using the pipeline

Get-MerakiNetworks | Get-MerakiDevices

Get-MerakiNetworkDevice

  • Description: Get a specific Device.
  • Parameters:
    • DeviceID: The device ID to retrieve

Get-MerakiOrganizationDevices

  • Description: Get all devices in an organization
  • Parameters:
    • OrgID: Organization ID, if omitted pulled from configuration file.

Get-MerakiApplienceVlanPorts

  • Description: Get port configuration for appliance ports.
  • Parameters
    • id: Network ID
      • Accepts Pipeline Input

Get-MerakiNetworkDeviceUplink

  • Description: Get uplink configuration for device
  • Parameters:
    • networkId: Network ID
      • Accepts value from pipeline
    • serial: Serial number of the device

Get-MerakiNetworkUplinkSettings

  • Description: Get uplink settings
  • Parameters:
    • id: Network ID
      • Accepts pipeline input

Get-MerakiNetworkVLANS

  • Description: Get all VLANS in a Meraki Network
  • Parameters:
    • id: The network ID
      • Accepts Pipeline entry
    • NoProgress: Switch to no display progress bar.

Examples: Get VLANS in a network

Get-MerakiNetworkVLANS -id N-XXXXXXXXXXXXXXX

Get VLANS in a Network using the pipeline

Get-MerakiNetwork -NetworkID N-XXXXXXXXXXXXX | Get-MerakiNetworkVLANS

Get VLANS from Multiple Networks without the progress bar

Get-MerakiNetworks | Get-MerakiNetworkVLANS -NoProgress

Get-MerakiNetworkVLAN

  • Description: Get a specific VLAN
  • Parameters:
    • NetworkID: Network ID
    • id: VLAN ID

Get-MerakiDeviceSwitchSettings

  • Description: Get switch settings for a network
  • Parameters:
    • id: Network ID
      • Accepts Pipeline input

Get-MerakiDeviceSwitchPorts

  • Description: Get Switch port settings for a device
  • Parameters:
    • serial: Serial Number of the device
  • Note: You can pass multiple devices to this command and it will filter out devices that are not switches. Example

Get-MerakiNetworks |Where-Object {$_.Name -Like "Dallas"} | Get-MerakiDeviceSwitchPorts

This will only get the ports for any MS switches in the network.

Get-MerakiApplianceVlanPorts

  • Description: Get MX Appliance Port VLANS
  • Parameters:
    • id: Network IS
      • Accepts pipeline input

Get-MerakiSSIDs

  • Description: Get SSID associated with a network
  • Parameters:
    • id: Network ID
      • Accepts pipeline input

Get-MerakiNetworkContentFilteringRules

  • Description: Get content filtering rules for a network
  • Parameters:
    • id: Network ID
      • Accepts Pipeline input

Update-MerakiNetworkContentFiltering

  • Description: Update the networks content filtering rules
    • NOTE: This is a REPLACE operation not a merge! See examples below
  • Parameters:
    • id: Network ID
      • **Accepts **Pipeline input
    • allowedURLPatterns: String array of URL patterns
    • blockedURLPatterns: String array of URL patterns
    • blockedURLCategories: object Array of URL Categories [do not modify this list using the API!]
    • urlCategoryListSize: Either 'topSites' or 'fullList'
    • ContentFilteringRules: An object containing the above content filtering rules.
      • You cannot use this parameter is you use the above perimeters. This must be used by itself. Examples You must pull the Content Filtering Rules using the function Get-MerakiNetworkContentFilteringRules and then modify the properties of that object.

Adding a new URL to the blocked URL Pattern

$cfr = Get-MerakiNetworks | Where-Object {$_.Name -like "Dallas} | Get-MerakiNetworkContentFilteringRules

$cfr.blockedUrlPatterns += "example.com"

Get-MerakiNetworks | Where-Object {$_.Name -like "Dallas"} | Update-MerakiNetworkContentFiltering -allowedUrlPatterns $cfr.allowedUrlPattern -blockedUrlPatterns $cfr.blockedUrlPatterns -blockedUrlCategories $cfr.blockedUrlCategories -urlCategoryListSize $cfr.urlCategoryListSize

or

Get-MerakiNetworks | Where-Object {$_.like "Dallas"} | Update-MerakiNetworkContentFiltering -ContentFilteringRules $cfr

Updating Templates

If you have networks bound to templates, you should update the template and allow the template to trickle the changes down to the bound network.

$cfr = Get-MerakiOrganizationConfigTemplates | Where-object {$_.Name -eq "Org-Tremplate"} | Get-MerakiNetworkContentFilteringRules

$cfr.clockedUrlPatterns += "example.com"

Get-MerakiOrganizationConfigTemplates | Where-Object ($_.Name -eq "Org-Template"} Update-MerakiNetworkContentFiltering -ContentFilteringRules $cfr

To get a list of networks not bound to a template use:

Get-MerakiNetworks | Where-Object {$_.configTemplateID -eq $null}

Get-MerakiOrganizationAdmins

  • Description: Get Organization Administrators
  • Parameters
    • OrgID: Organization Id. If omitted, then pulled from config file.

Get-MerakiOrganizationConfigurationChanges

  • Description: Get Change log entries.
  • Parameters:
    • OrgID: Organization ID. If omitted then pulled from config file
    • StartTime: Start date to pull logs (cannot be > 365 days old)
    • EndDate: End date to pull logs.
    • TimeSpan: Time span in days prior to today to pull logs. Cannot be > than 365 days prior to current date. If used, do not specify Start and End Dates.
    • PerPage; Number of records per page. 3 - 5000 The default is 5000
    • NetworkID: Network ID to filter logs by.
    • AdminID: Admin ID to filter logs by.

Examples Filter logs for last 10 days by Administrator.

Get-MerakiOrganizationAdmins | Where-Object {$_.Name -eq "John Doe"} | Get-MerakiOrganizationConfigurationChanges -TimeSpan 10

Filter logs for changes to the Miami network that occurred between 6/1/2020 and 6/30/2020

Get-MerakiNetworks | Where-Object {$_.Name -like "Miami"} | Get-MerakiOrganizationConfigurationChanges -StartTime "06/01/2020" -EndTime "06/30/2020"

Get-MerakiOrganizationConfigTemplates

  • Description: Get configuration templates
  • Parameters:
    • OrgID: Organization ID. If omitted will be read from config file.

Get-MerakiNetworkSiteToSiteVPN

  • Description: Get Meraki Network Site-to-Site VPN settings
  • Parameters:
    • id: Network ID
      • Accepts pipeline input.

Get-MerakiNetworkEvents

  • Description: Get Meraki network events
  • Parameters:
    • id: Network ID
      • Accepts pipeline input.
    • ProductType: Can be one of wireless, appliance, switch, systemManager, camera, cellularGateway,
      • Required
    • includedEventTypes: Array of event types to include.
    • excludedEventTypes: Array of event types to exclude.
    • deviceMac: MAC address of device to filter on
    • deviceName: Name of device to filter on.
    • clientName: Name of client to filter on.
    • clientIP: IP of client to filter on.
    • clientMac: MAC address of client to filter on.
    • smDeviceName: System Manager name to filter on.
    • smDeviceMac: System Manager MAC to filter on.
    • perPage: Number of event to retrieve per page. Can be 3-5000, 5000 is default.
    • startingAfter: Get events after this date time.
      • If omitted, the call will retrieve the number of events specified by the pageSize parameter prior to the time specified in the endingBefore parameter.
    • endingBefore: Get events ending before this date time.
      • If omitted, the call will retrieve the the number of events specified in the pageize parameter after the time specified in the startingAfter parameter.
      • If both startingAfter and endingBefore are omitted the call will retrieve the number of events specified in the pageSize parameter prior to the current date, time.
    • first: Get the first result page.
    • prev: Get the previous result page.
    • next: Get the next result page.
    • last: Get the last result page.

Note: You can get a list of event types in use for a network use the Get-MerakiNetworkEventTypes

Examples

Get content filtering network events for a network.

Get-MerakiNetworks |{$_.Name -like "Dallas"} | Get-MerakiNetworkEvents -includedEventTypes 'cf_block' -ProductType appliance

Get network events for a specific client Get-MerakiNetworkEvents -clientName 'DALJohnDoe'

Paging

The maximum number of events you can retrieve per call is 1000. There are many events and 1000 events may only span a time period of a few minutes. To retrieve more events you can use subsequent function calls with the paging parameters.

In the following command we retrieve the the content filtering events for the Dallas network for the month of June.

Get-MerakiNetworks |{$_.Name -like "Dallas"} | Get-MerakiNetworkEvents -includedEventTypes 'cf_block' -ProductType appliance -startingAfter "06/01/2020" -endingBefore "06/30/2020" -pageSize 50

This call will retrieve the first 50 events that meet the time span specified. There are significantly more events that meet this criteria. To retrieve the next page of events reissue the call and append the -next paging parameter.

Get-MerakiNetworks |{$_.Name -like "Dallas"} | Get-MerakiNetworkEvents -includedEventTypes 'cf_block' -ProductType appliance -startingAfter "06/01/2020" -endingBefore "06/30/2020" -pageSize 50 -next

If -endingBefore is not specified, -last will retrieve the page prior to the current date & time.

If -startingAfter is not specified, -first will not return a page.

If you issue a subsequent call without a paging parameter, paging is reset.

Get-MerakiNetworkEventTypes

  • Description: Get event types in use for a network.
  • Parameters:
    • id: Network ID.
      • Accepts pipeline input.

Get-MerakiOrganizationThirdPartyVPNPeers

  • Description: Get third party VPN peers for the Organization
  • Parameters:
    • OrdID: Organization ID
      • If omitted it will be read from configuration file.

Get-MerakiOrganizationInventory

  • Description: Get inventory for the organization
  • Parameters:
    • OrgID: Organization ID
      • If omitted will be read from configuration file

Get-MerakiNetworkSecurityEvents

  • Description: Get network security events
  • Parameters:
    • id: Network Id
      • Accepts pipeline input
    • StartTime: Starting Date to pull events
    • EndDate: Ending date to pull events
    • timespan: Number of days back to pull event (if used to not use startTime or end Time). Max 365 days
    • perPage Number of events per page.

Get-MerakiOrganizationSecurityEvents

  • Description: Get security events for the Organization
  • Parameters:
    • OrgID: Organization ID. If omitted will be read from configuration file.
    • StartTime: Starting Date to pull events
    • EndDate: Ending date to pull events
    • timespan: Number of days back to pull event (if used to not use startTime or end Time). Max 365 days
    • perPage Number of events per page.

Get-MerakiNetworkApplianceStaticRoutes

  • Description: Get static routes for a network appliance.
  • Parameters:
    • id: Network ID
      • Accepts pipeline input.

Clone this wiki locally