Automating with PowerShell: Unifi PowerShell module and creating network maps

So this blog is a two for one as I’m on vacation right now and enjoying some time off. First I’d like to tell you about a new module I’ve created and am starting to work on some more. Last week I’ve had a small thread on twitter with a friend that said something like “I’d love a tool that creates a draw.io network map for me” and I figured that would be a pretty cool tool too.

Network mapping with PowerShell

After some figuring out it seems that Draw.io allows you to import data as a CSV. I’ve created a PowerShell module that scans your entire network and creates a cool overview using the draw.io standard CSV. This makes it easy to perform a quick scan and see all devices immediately. It currently does some “Guess-smart” matching on what the device type is, but I’m expanding the module rapidly.

To find this project, check out the github page here. Using it is dead simple, the following creates a network map file in C:\Temp

install-module PsdrawIO
New-Networkmap -Network 192.168.15.1/24 -Layout organic | out-file "C:\Temp\Example.csv"

Which looks like this as the end result;

Example

Unifi PowerShell module

Next up is a module that is not mine. A friend of mine asked me for some help in creating his first module and I was glad to help him because it’s a pretty awesome project. The Unifi PowerShell module allows you to connect to any Unifi Controller and extract data easily. This could make monitoring and documenting Unifi infrastructure a whole lot simpler.

If you wanna check out that module, check the github page here. Michael has done an amazing job on this.

And that’s it! as always, Happy Powershelling

2 Comments

  1. Steve G July 27, 2021 at 4:11 pm

    Is it possible to scan two networks?
    ie. New-Networkmap -Network 192.168.15.1/24,10.10.10.1/24 -Layout organic | out-file “C:\Temp\Example.csv”

    So that I can get the subnets on a client network also? The ‘scan all connected networks’ option does not work, or not working right for me?

  2. Jessie Leighty October 29, 2021 at 1:50 am

    Hi,
    I have been trying to deploy this for weeks now and I am completely confused on how to use this script. I finally got the module installed and imported but how do I import the CSV results into a map? the instructions are vague at best here… please help, I’m really struggling… 🙁

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.