PowerShell based auditing and reporting for UniFi Network environments.
This project performs read only inspection of a UniFi deployment so you can:
- document current state
- verify expected network policy
- export inventory and findings for review
The audit workflow:
- Authenticates to the UniFi controller
- Enumerates available sites
- Collects inventory for the target site
- Runs policy tests
- Exports JSON and CSV reports
Collected inventory includes:
- Networks
- WLANs
- Devices
- Clients
- Firewall groups
- Firewall rules
Policy tests include:
- Expected DNS server presence in network settings
- Expected SSID presence
- Open WLAN detection
UniFi/
|-- Modules/
| |-- Unifi.Auth.psm1
| |-- Unifi.Inventory.psm1
| |-- Unifi.Reporting.psm1
| |-- Unifi.Tests.psm1
| `-- readme.md
|-- Documentation/
| `-- readme.md
|-- Reports/
| `-- readme.md
|-- CountryBlockList.txt
|-- LICENSE
|-- README.md
|-- UnifiAudit.ps1
`-- config.json
- PowerShell 7 or later
- Network access to the UniFi controller
- Credentials with read access to UniFi Network
Edit config.json:
{
"ControllerUrl": "https://192.168.0.1",
"Site": "default",
"ExpectedDnsServer": "192.168.0.10",
"ExpectedSsids": [
"Species8472_PV",
"Species8472_PV_IoT",
"Species8472_PV_Work"
],
"OutputPath": ".\\Reports",
"SkipCertificateCheck": true
}ControllerUrl: Base URL for UniFi controllerSite: UniFi site name. Defaults todefaultif blankExpectedDnsServer: DNS value expected in network configsExpectedSsids: SSIDs that should existOutputPath: Folder for timestamped reportsSkipCertificateCheck: Settruefor self signed cert environments
The script supports two auth modes:
- Environment variables
- Interactive credential prompt
Environment variable option:
$env:UNIFI_USERNAME = "your-username"
$env:UNIFI_PASSWORD = "your-password"Run with config file:
./UnifiAudit.ps1Run with explicit config path:
./UnifiAudit.ps1 -ConfigPath ./config.jsonOverride settings at runtime:
./UnifiAudit.ps1 `
-ControllerUrl "https://192.168.0.1" `
-Site "default" `
-ExpectedDnsServer "192.168.0.10" `
-ExpectedSsids "CorpWiFi","CorpIoT" `
-OutputPath ".\\Reports" `
-SkipCertificateCheckReports are written to OutputPath using a timestamped naming pattern:
Sites_yyyyMMdd_HHmmss.jsonand.csvNetworks_yyyyMMdd_HHmmss.jsonand.csvWlans_yyyyMMdd_HHmmss.jsonand.csvDevices_yyyyMMdd_HHmmss.jsonand.csvClients_yyyyMMdd_HHmmss.jsonand.csvFirewallGroups_yyyyMMdd_HHmmss.jsonand.csvFirewallRules_yyyyMMdd_HHmmss.jsonand.csvFindings_yyyyMMdd_HHmmss.jsonand.csv
CSV export is attempted for enumerable datasets.
This project is designed as read only.
Current modules use GET for inventory operations and POST only for authentication.
- Auth failure: verify credentials and controller URL
- TLS/cert failure: use
SkipCertificateCheckin trusted internal environments - Empty datasets: confirm target site name and account permissions
- Missing expected SSID or DNS findings: verify
ExpectedSsidsandExpectedDnsServervalues
MIT License. See LICENSE.