How to Use PowerShell to Find a Video in Windows File Explorer and View It in Milestone XProtect

Table of Contents

Windows PowerShell is a powerful scripting language that can be used to automate many tasks on Windows systems. In this blog post, we will show you how to use PowerShell to find a specific video in the Windows File Explorer and view it in the Milestone XProtect player.

Why You Shouldn't Even Bother To Search Windows File Explorer Without PowerShell

Finding a video using Windows File Explorer is one of the most frustrating experiences I’ve encountered. It’s basically impossible. First you’ll need to wait until Windows loads millions of files and folders. Then if, and only IF, you are lucky enough that it actually loads, you must search, sort, and dig to find the right folder. It’s the definition of a needle in a haystack situation!

It will take a toll on you. Trust me…

With not a hair left on my head, I knew I needed to find a new solution.

Enter PowerShell!

With Windows PowerShell, you can query a folder, and its child folders using specific keywords including CAMERAS!

Here’s how to do it:

What You Need to Know Before You Start

Folder Aliases & How to Find The Folder GUIDs

In Windows, file explorer XProtect uses aliases to make the folder structure human-readable. These aliases are not real folder names and are unusable in a Powershell script.

An easy way to figure out the actual folder name is to just click on the address bar in Windows file explorer.

Here is what the address bar looks like with aliases.

Here is what it looks like after clicking in. This is the actual folder name.

That long string of characters separated by dashes is generally called a GUID.  So in this case, 09f85974-d9ca-4e74-bd14-195cb547f62f is the folder GUID.

How to Find The Camera GUIDs

Cameras also have GUIDs, and you will need to know the GUID of the camera you are trying to find the video for.

There are several ways to find the camera GUID, but the easiest way is through the management client.

  1. Log into XProtect management client
  2. Click on Recording Servers
  3. Expand the recording sever of the associated camera
  4. Expand the hardware the camera is under
  5. Hold crtl+click on the camera name
  6. In the Info tab of the camera, scroll down, and you will see the ID
  7. In this case, our camera GUID is 1E18F205-C059-4EEC-A745-E5138DBDF11D

How to Use PowerShell To Find a Specific Camera

Now that you have the basics, it is time to put it together.  We will use the commandlet below to search our live database folder for a specific camera.

Get-ChildItem -path folder_path_uri -Directory -Filter *camera_GUID* | Out-GridView

The | Out-GridView switch is optional but is super helpful. It publishes the data into an excel-like table you can sort and filter through.

Let’s try this using the info for the folder and camera GUIDs we found above:

Folder to search through:

D:\MediaDatabase\09f85974-d9ca-4e74-bd14-195cb547f62f

Camera to search through:

1E18F205-C059-4EEC-A745-E5138DBDF11D

Get-ChildItem -path D:\MediaDatabase\09f85974-d9ca-4e74-bd14-195cb547f62f -Directory -Filter *1E18F205-C059-4EEC-A745-E5138DBDF11D* | Out-GridView

Here is the output using the Out-GridView switch:

Now you can see all the folders in the file system that contain video for the specific camera without waiting ages for the folders and files to render in Windows File Explorer.

Once in grid view, you can click the “Add Criteria” button and filter the results to focus your search results further.

Lastly, you may want to browse a specific camera folder in the Name column of the grid.

To do this, take the folder path URI, and the camera folder name found in the name column and add them together, as shown below.

folder_path_url+/+ camera_folder_name

D:\MediaDatabase\09f85974-d9ca-4e74-bd14-195cb547f62f\1e18f205-c059-4eec-a745-e5138dbdf11d_LOCAL_2022-09-25_13-22-06

We hope you found this blog useful and really hope you found it in time to save you from the anguish of having to figure it out on your own.

Pay it forward by sharing this PowerShell hack with all of the security administrators you know and help them avoid countless hours of boredom and disappointment watching files load and crash repeatedly.

If you want more helpful tips and tricks for managing your video security system, sign up for our [NOT] Boring Newsletter to get a monthly dose of genius direct to your inbox.

Team Boring

Your go-to XProtect eXPerts. We learn the technical stuff that will save you time and make it less boring.

Team Boring

Your go-to XProtect eXPerts. We learn the technical stuff that will save you time and make it less boring.

You Might Also Enjoy…