Powerup your PowerShell scanners with Git

Brock Bingham candid headshot
Brock Bingham|December 16, 2021
git
git

There's something magical about taking something good and making it great. Twinkies? Good. Deep-fried Twinkies covered in powdered sugar? Amazing. Perhaps a more relevant example of making awesome things even more awesome is when you combine PDQ Inventory's PowerShell Scanners with GitHub. What makes this a match made in heaven, and how can you take advantage of it? Let's find out!

What are Git and GitHub?

git1

To understand what GitHub is, you first need to understand what Git is. Git is an open-source, distributed versioning control system developed by Linus Torvalds. If that name rings a bell, that's because he's the primary developer behind the Linux kernel. Yeah, he's kind of a big deal. Anyways, Git was created as a way for developers to collaborate on projects while maintaining versioning control and historical records. Focused on speed, simplicity, and a distributed design, Git makes it easy for developers all over the world to contribute to projects without the fear of accidentally altering a master branch.

GitHub, on the other hand, is a cloud-based Git repository hosting service. While Git is traditionally managed from a command-line interface, GitHub provides a simple, intuitive graphical web interface to manage Git repositories. GitHub also layers in additional features to simplify collaboration, access controls, forking, pull requests, and merging. GitHub's functionality has made it a very popular platform, and not just for developers. A diverse collection of project types are taking advantage of Git and GitHub's features. In fact, Microsoft thought GitHub was such a useful platform that they acquired it in 2018 for $7.5 billion.

Expanding your scanner library With Git and GitHub

One of the ways PDQ.com utilizes GitHub is by hosting Git repositories dedicated to providing expanded functionality in PDQ Deploy and PDQ Inventory. The great thing about these repositories is that they are open to the public, which enables our super-smart users to submit their own useful additions to the repositories.

One of the repositories we host on GitHub is the PowerShell-Scanners repository, which contains dozens of useful PowerShell scanners that can be imported into PDQ Inventory. Let's take a look at how we can use Git to clone the repo onto our local machine.

The first thing we need to do is install Git on our machine. Luckily, PDQ Deploy has a pre-built Git package that we can use to make this step super easy.

  • With PDQ Deploy open, click on Package Library.

  • In the Filter field, enter Git to narrow down the search results.

    git2
  • Select Git for Windows and click Download Selected (As Auto Download).

    git3
  • Once the package finishes downloading, right-click on it and select Deploy Once.

    git4
  • Enter the target machine for this deployment and click Add Computer. Since I'm installing it locally, I've entered the localhost address 127.0.0.1.

  • Click Deploy Now when you are ready to deploy the package.

    git5

Once Git has been installed, we can use it to clone the PowerShell Scanner repo using a simple, one-line Git command.

git clone https://github.com/pdq/PowerShell-Scanners.git C:\PowerShell-Scanners
git7

This Git command will create a copy of the repo onto the root of your C: drive.

git6

If you want to update your local copy of the repository in the future, Git makes it super easy by using the following command:

cd C:\PowerShell-Scanners git pull

Before you start importing scanners into PDQ Inventory, I recommend browsing through the list of scanners you just cloned from the repo. Each scanner is organized into its own folder, and each folder contains a README.md file which can be opened with Notepad.exe. The readme files describe what the scanners do. For example, if I browse out to C:\PowerShell-Scanners\PowerShell Scanners\DNS Servers and open up the README.md file, here's the information it gives me about the DNS Servers scanner.

git10
# Instructions [How to use this repository](../../README.md) # Description Retrieves the list of DNS servers the target is configured to use. # Author Colby Bouma

Browsing through the available scanners and reading their readme files will give you an idea of how you can best utilize the scanners from the repo.

Importing scanners into PDQ Inventory

Now that we have our PowerShell-Scanners repository cloned, we can import the scanners into PDQ Inventory. If you 

  • With PDQ Inventory open, click File > Import. This will open a File Explorer window.

    git8
  • Browse to the location where you cloned the PowerShell-Scanners repo. By default, the location should be C:\PowerShell-Scanners.

  • Open the PowerShell-Scanners folder located inside C:\PowerShell-Scanners.

    git9
  • Open the folder of the scanner you want to import. (For this example, I'll use the DNS Servers scanner.)

  • Select the Scan Profile.xml file and click Open.

    git11
  • You should receive a prompt that says "Import Complete". Click Close.

    git12
  • To view your new scan profile, click the Scan Profiles button.

    git13

Using imported scanners

With our new scan profile imported, we can run it just like any of the built-in scan profiles.

  • Right-click All Computers, then click Scan Collection > Scan Profile Name (PS - DNS Servers in my example.

    git14
  • You'll see the scan status reflect the current progress of the scan.

    git15
  • To view the scan results, once the scan is complete, double-click on any of the scanned devices, then click on the PowerShell menu item.

    git16
  • Lastly, click on the drop-down menu button and select the correct scan profile to view the results.

    git17git18

Wrapping Up

Git and GitHub are changing the way people collaborate on projects. And while learning these systems can seem daunting at first, once you get past the basics, you'll find these platforms offer a lot of functionality that you can utilize to enhance your next project's workflow.

To make the most of the PowerShell-Scanners repository, make sure you update your local copy frequently. New content is being added all the time. When you're ready, consider submitting your own super cool custom scanner to be added to the PDQ PowerShell-Scanner repository. Submitting your own scanner is a great way to help out the community and get your work recognized. If you need help submitting your scanner, check out our PowerShell Scanners webcast that will guide you through the process.

Brock Bingham candid headshot
Brock Bingham

Born in the '80s and raised by his NES, Brock quickly fell in love with everything tech. With over 15 years of IT experience, Brock now enjoys the life of luxury as a renowned tech blogger and receiver of many Dundie Awards. In his free time, Brock enjoys adventuring with his wife, kids, and dogs, while dreaming of retirement.

Related articles