# Track Ubiquiti Unifi Stock, and get notified of changes

I am a pretty big fan of Ubiquiti and their Unifi products line. Whether it’s network equipment or their camera systems, Unifi Protect, I have it all, and I’m pretty happy with how it works. However, over the last two years, some of their stocks in the store were very hard to find. For example, I’ve searched for Unifi Protect G4 Doorbell Pro for over six months. I’ve tried local shops all around Europe, even in the Ubiquiti Europe store, to never found any of them.

blog

16 Apr 2023 pl

![Track Ubiquiti Unifi Stock, and get notified of changes](/wp-content/uploads/2023/04/img_643ac54772e12.png)

[Zobacz obrazy (8)](#pf-content-image-1-0)

I am a pretty big fan of **Ubiquiti** and their **Unifi** products line. Whether it's network equipment or their camera systems, **Unifi Protect**, I have it all, and I'm pretty happy with how it works. However, over the last two years, some of their stocks in the store were very hard to find. For example, I've searched for **Unifi Protect G4 Doorbell Pro** for over six months. I've tried local shops all around Europe, even in the **Ubiquiti Europe** store, never to see them.The thing is, I am not the only one. If you go to **Reddit's** very own community, [Ubiquiti](https://www.reddit.com/r/Ubiquiti/), plenty of people are searching for different products and waiting for them to be dropped into the store. There is even a dedicated [r/UbiquitiInStock](https://www.reddit.com/r/UbiquitiInStock/) community where a bot shows what's in the store and what goes out. After trying it out, I've noticed that getting notifications from **Reddit** was always too late for me because of the delay. There were just many false positives for me because I was only searching for specific products while the notifications were coming all day for different ones. And while waiting for **Unifi G4 DoorBell Pro** for over a week, I've not seen a single drop, but at the same time, I saw plenty of other equipment that I was not interested in. While other tracking services could help, or I could buy it secondhand for two times the vendor price, I decided that it's better to try and write my tracker and see if it can help me.

### 💡 Using PowerShell to find Ubiquiti stock on Unifi Store

If you know my work, you would know I would use **PowerShell** to achieve my goals. After playing with the Unifi Store backend, I've created a small **PowerShell** module to help me get the **Doorbell** I wanted! This PowerShell Module is tiny and has only two functions **Get-UnifiStock** and **Wait-UnifiStock**. The first one I've created allows for an accessible overview of what's in store when checking different collections of products, while **Wait-UnifiStock** is to be directly used when waiting for something.

```powershell
Get-UnifiStock -Store USA -Collection Protect, ProtectAccessories, ProtectNVR | Sort-Object -Property Name | Format-Table
```

[!\[Tabela stanów magazynowych Ubiquiti dla sklepu USA w PowerShellu\](/wp-content/uploads/2023/04/img_643ac8954f90c.png)](/wp-content/uploads/2023/04/img_643ac8954f90c.png)

With a simple one-line of code that you can copy and paste into a **PowerShell Window** (Press Start, type **PowerShell**, and press enter), you can now play with Unifi Stock from different **Ubiquiti** stores around the world. The following query shows a query to the **Unifi Store in Europe** with the requirement of returning only **Protect** and **NetworkWIFI** devices. Then we use **Sort-Object** to sort the data produced by the Shop by **Name** and force the output into a table.

```powershell
Get-UnifiStock -Store Europe -Collection Protect, NetworkWifi | Sort-Object -Property Name | Format-Table
```

[!\[Tabela stanów magazynowych Ubiquiti dla Europy, tylko produkty Protect i NetworkWiFi\](/wp-content/uploads/2023/04/img_643ad19251ecb.png)](/wp-content/uploads/2023/04/img_643ad19251ecb.png)

You can skip parameter collections and ask for everything the shop has in store.

```powershell
Get-UnifiStock -Store Europe | Sort-Object -Property Name | Format-Table
```

[!\[Tabela wszystkich produktów Ubiquiti dostępnych w Europie\](/wp-content/uploads/2023/04/img_643ad2ba00a71.png)](/wp-content/uploads/2023/04/img_643ad2ba00a71.png)

With some PowerShell magic, you could find out which products are currently out of stock. Using Where-Object and property Available, we ask the query only to return unavailable products.

```powershell
Get-UnifiStock -Store Europe | Where-Object { $_.Available -eq $false } | Sort-Object -Property Name | Format-Table
```

[!\[Tabela produktów Ubiquiti niedostępnych w Europie\](/wp-content/uploads/2023/04/img_643ad437b55b1.png)](/wp-content/uploads/2023/04/img_643ad437b55b1.png)

While **Get-UnifiStock** is helpful, it's mostly to find out the names, categories, or SKU numbers that can be later on used in the **Wait-UnifiStock** command.

### 💡 Waiting for the right product on Unifi Store

**Wait-UnifiStock** is the simple command that helps to get notified when the stock is in. When you run that command, it doe the followings:

- Wait for the given product to appear in store or use the given interval (default every 60 seconds)
- When the product shows up as available, it will: Use speech synthesis to say: “Hey, there is stock available for XXX.”
- Open a website in your default browser directly on the product you want to buy and bring it to the front.

It's pretty simple in what it does, but it's what I needed.

```powershell
Wait-UnifiStock -ProductName 'Access Point AC Lite' -Seconds 60
```

[!\[Okno PowerShell z poleceniem Wait-UnifiStock dla Access Point AC Lite\](/wp-content/uploads/2023/04/img_643ae039c9db3.png)](/wp-content/uploads/2023/04/img_643ae039c9db3.png)

```powershell
Wait-UnifiStock -ProductName 'UniFi6 Mesh', 'G4 Doorbell Pro', 'Camera G4 Pro', 'Test' -Seconds 60
```

[!\[Okno PowerShell śledzące kilka produktów Ubiquiti poleceniem Wait-UnifiStock\](/wp-content/uploads/2023/04/img_643ae05dde7e2.png)](/wp-content/uploads/2023/04/img_643ae05dde7e2.png)

```powershell
Wait-UnifiStock -ProductSKU 'UDR-EU' -ProductName 'Switch Flex XG' -Seconds 60
```

[!\[Okno PowerShell oczekujące na stan UDR-EU i Switch Flex XG\](/wp-content/uploads/2023/04/img_643ae0dc159f5.png)](/wp-content/uploads/2023/04/img_643ae0dc159f5.png)

The above example shows that you can use **ProductName** or **ProductSKU** (or both) to wait for the product you need. You can also query multiple products at once, and the ones that do not exist (typos) will be ignored. You can also control refresh time by using the Seconds parameter. If you skip it, the default value will be every 60 seconds which is good enough to find what you need. Remember that using anything below **60 seconds** may be tempting, but it may get you blocked. This is because you're querying **API every 60 seconds**. If you change it to 5, **antispam** filters may kick in and deny further requests to API and the whole website. Please be responsible!**UnifiStockTracker** supports Ubiquiti shops in 9 different countries: Brazil and China, Europe, India, Japan, Mexico, Singapore, Taiwan, and the USA. When you choose the Store parameter, you will get autocomplete for that. Like Collection, you will get autocomplete in one of the available options: NetworkOS, NetworkSmartPower, NetworkWifi, ProtectAccessories, NetworkRoutingOffload, NetworkSwitching, Protect, or ProtectNVR.

### 💡 Installing UnifiStockTracker PowerShell module

If you would like to use this PowerShell module all you need to do is open PowerShell, and type

```powershell
Install-Module UnifiStockTracker -Force -Verbose -Scope CurrentUser
```

[!\[Polecenie Install-Module dla modułu UnifiStockTracker w PowerShellu\](/wp-content/uploads/2023/04/img_643ae912e257e.png)](/wp-content/uploads/2023/04/img_643ae912e257e.png)

Once you do this, you can use the commands mentioned above. The module is downloaded from **PowerShellGallery** hosted by **Microsoft**. If you want to review sources or add some features feel free to explore [UnifiStockTracker on GitHub](https://github.com/EvotecIT/UnifiStockTracker).

## Powiązane projekty

Projekty powiązane z tagami, kategoriami i treścią tego wpisu.

[Wszystkie projekty](/projekty/)

Trwa dopasowywanie projektów...

[Powrót do bloga](/blog/)

## Powiązane wpisy

- [Check an API write after a PowerShell timeout](/blog/verify-uncertain-api-outcomes-powershell/)
- [Inspect and convert mixed Office archives with PSWriteOffice](/blog/inspect-and-convert-mixed-office-archives-pswriteoffice/)
- [Compose PDF reports and automate page workflows with PSWriteOffice](/blog/automate-pdf-reports-and-page-workflows-pswriteoffice/)

<!-- PowerForge markdown artifact sha256:7AF6C37BE9FA10F913CAF9915ED20608B12439CA496402FECEABEC783913FCC2 -->
