Almost two years ago I rebuilt my home network with Ubiquiti Unifi equipment. Yet it wasn’t until recently I wanted to programmatically get configuration information out of it. Luckily there were a number of examples accessing the Unifi API, but none with PowerShell. This post is about accessing your Ubiquiti Unifi network configuration with PowerShell. I show how to obtain a list of Sites, Devices and Clients. Then how to report on a list of clients status (Active or Away).
To report on your Unifi network configuration with PowerShell you will need to update the following script with your;
It assumes that your configuration is using the default Site Name (but you can change that in Line 4) and that your controller is using a self-signed certificate (default).
The following script looks at Active Clients and Registered Clients to determine whether a Registered Client is currently active or away. When the interesting client is a mobile phone this essentially becomes and Who’s Home or Away.
In conjunction with a notification service (such as Push Bullet that I used in this solution) you can trigger notification alerts.
Update the following script for;
The output is
This info could then be put into a notification if you so desired. Something like Push Bullet like I did in this post. You will need to do a little manipulation to get a nice multi-line output for the notification though. The following snippet shows how I did it. Add your Push Bullet Access Token in line 3.
Using PowerShell anything is possible. Even connecting to our Ubiquiti Unifi implementation and retrieving info on clients and devices.
A few weeks back the Microsoft AI Tour was in Sydney Australia. There was a…
If you're anything like me you always have PowerShell open, and often both PowerShell and…
Decentralised Identity is a technology I'm passionate about and have written many posts and tools…
Over two years ago I authored a PowerShell Module that enabled the automation of 1Password.…
Buried in my PowerShell Snippets Vol 4 post from 2021 is the PowerShell script and…
Short post on how to recovery from "The Windows Subsystem for Linux instance has terminated"…
This website uses cookies.
View Comments