PowerShell

Accessing your Ubiquiti Unifi network configuration with PowerShell

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).

Sites, Devices and Active Clients

To report on your Unifi network configuration with PowerShell you will need to update the following script with your;

  • Unifi Controller Address
  • Unifi Admin User ID
  • Unifi Admin Users’ Password

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).

See the gist on github.

Who’s Home or Away?

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;

  • interesting clients (lines 3-5)
  • your Controller and Account settings as per the script above (lines 8-13)

See the gist on github.

The output is

Ubiquiti Unifi Who’s Home or Away

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.

See the gist on github.

Summary

Using PowerShell anything is possible. Even connecting to our Ubiquiti Unifi implementation and retrieving info on clients and devices.

Darren Robinson

Bespoke learnings from a Microsoft Identity and Access Management Architect using lots of Microsoft Identity Manager, Azure Active Directory, PowerShell, SailPoint IdentityNow and Lithnet products and services.

View Comments

Recent Posts

Entra Provision On Demand PowerShell Module

It’s 2026 and somehow I keep finding myself back in 2016, integrating heritage applications into…

5 days ago

Entra News MCP Server

I’ve just published an MCP server that turns Merill & Joshua’s weekly Entra News newsletter…

2 weeks ago

Entra ECMA2Host Tools PowerShell Module

If you've ever worked with the ECMA2Host for Entra Outbound Provisioning you'll be immediately presented…

3 months ago

PowerShell 7 Support Arrives for the Granfeldt PowerShell Management Agent

For over a decade, the Granfeldt PowerShell Management Agent (PSMA) has been the bedrock for…

5 months ago

PowerShell MCP Azure Function Server

Recently under the experimental Azure Functions build Microsoft Developer Advocates have shown enabling Azure Functions…

6 months ago

EntraPulse – Your AI-Powered Gateway to Microsoft Graph & Docs

Today, I’m super excited to finally announce the Beta release of EntraPulse Lite – a…

8 months ago

This website uses cookies.