Continuing scripts to pull more information from Cisco WLC’s.
Find my original Cisco WAP post here:
Pre-requisites:
- Add Custom Command to IOS-XE for collection “show ap image | inc None”
- Add Tag of “WLC” on your Wireless Controllers
- WLC’s are on c9800 running IOS-XE
IOS-XE version is 17.x.x

/**
* @intent - pull Name & OS Versions from Cisco AP's via Cisco WLC's
* @description Log into Cisco WLC's "C9800" and pull AP information from the controllers with "show ap image | inc None"
**/
// Pattern of output//
AP_INFO =
```
{APName:string} {PrimaryOS:string} {BackupOS:string}
```;
foreach device in network.devices
let platform = device.platform
foreach Tag in device.tagNames
where Tag == "WLC"
foreach Command in device.outputs.commands
where Command.commandText == "show ap image | inc None"
let parsed = parseConfigBlocks(OS.IOS_XE, Command.response) //parses text into lines
let matchData = blockMatches(parsed, AP_INFO) //applies pattern to lines
foreach x in matchData
select {
name: device.name,
Location: device.locationName,
AP_NAME: x.data.APName,
"Primary OS": x.data.PrimaryOS,
"Backup OS": x.data.BackupOS,
}