Tim Seger

WAS API Requests with PowerShell

Discussion created by Tim Seger on Mar 25, 2015

When I first started working with Qualys, I wanted to be able to use PowerShell to make API requests. I haven't been able to find a lot of pertinent information, so I started working on a set of scripts of my own.

 

Lately, I have been focusing on writing scripts that are to be used with the Web Application Scanning API. I have collated some of those scripts into a module and am posting the essentials of that module. This script only contains one WAS API request - getting current web application counts; the remaining functions are related to creating the XML file that is passed when the request is made, prompting for and processing of credentials, making the API request, and parsing the output file. The functions do not have help sections yet, but I am working on that. The method I am using to make the API request requires PowerShell version 3 to be installed on the computer.

 

To use this file as a script, save the file to your computer, and change the file extension from .txt to .ps1.

 

To use this file as a module, save the file to your computer and change the file extension from .txt to .psm1. To enable PowerShell to automatically load the module and the cmdlet it contains, create a folder that is named the same as the module file name within one of the file paths listed in $env:PSModulePath, and copy or move the module file to the folder that is named for the module.

 

Tim

Attachments

Outcomes