Skip to main content
All CollectionsRunning HawkScan
How to run the HawkScan CLI on Windows (Powershell)
How to run the HawkScan CLI on Windows (Powershell)

Installing and running the StackHawk CLI on native Windows

Anthony Stinn avatar
Written by Anthony Stinn
Updated over a year ago

Description

Windows users wishing to install the HawkScan CLI may do so conveniently with either:

Option 1: Windows MSI Installer (Beta)

Option 2: Manual ZIP File Installation


Procedure -- MSI Installer

Simply follow the instructions in Install with MSI (Windows) (BETA).

This is the preferred method for installation where possible.


Procedure -- ZIP File Installation

Requirements

The overall requirements to run HawkScan on Windows are:

  • A full OpenJDK environment is installed (a JRE only is insufficient)

  • The Windows Path Environment Variable contains:

    • the directory of the java program associated with the JDK

    • the directory containing HawkScan (talon-bootstrap-x.x.x.jar)

  • The Windows JAVA_HOME Environment Variable is present and contains:

    • the directory of the java program associated with the JDK

Phase 1: Install Java

  1. Install an OpenJDK

  2. Ensure that the JDK's directory is present in the Windows Path variable

    1. Powershell: echo $env:PATH

    2. Windows GUI: Settings-->Edit Environment Variables-->Select System or User-->Path

  3. Create a System Environment variable, JAVA_HOME, containing the same path to java as is populated in $env:PATH

Examples:

Powershell (after Microsoft JDK 17 install):

PS C:\Users\Dan\hawk-2.7.0> echo $env:PATH

C:\Program Files\Microsoft\jdk-17.0.4.101-hotspot\bin; [...]

GUI (after Microsoft JDK 17 install):

(In the above case, C:\Program Files\Microsoft\jdk-17.0.4.101-hotspot\bin was already in the path as a result of the JDK installation; if it's absent, it can be added via the 'New' button)

Phase 2: Install and run HawkScan

  1. obtain the latest version of the HawkScan CLI ZIP file

  2. unzip the cli zip file in your preferred directory

    • for instance: C:'Users\Dan\hawk-2.7.0

  3. create a .hawk directory under the associated user’s home directory (local scan logs will be stored here)

    • Powershell example: mkdir ~/.hawk

  4. set HawkScan into the PATH variable:

    • Windows GUI:

      • Settings-->Edit Environment Variables-->Select System or User-->Path-->Add hawk directory to Path (e.g., C:\Users\Dan\hawk-2.7.0)

    • Powershell:

      • $env:PATH="C:\Users\Dan\hawk-2.7.0; $Env:PATH"

  5. ensure that the OpenJDK is in the path; set it if not

    • Example: $env:PATH="C:\Program Files\Java\jdk-18.0.1.1\bin;$Env:PATH"

  6. create a System-level JAVA_HOME variable containing the OpenJDK path

  7. (exit and re-launch Powershell after setting all PATH entries)

  8. run the appropriate hawk in Powershell (hawk commands run from the hawk.ps1 script). For example:

Notes:

  • Options syntax in Powershell follows the CLI Command Options syntax.

    • For instance, to turn on debug:

      • hawk scan --debug


Additional Information

Another Option for Running the CLI on Windows is to enable WSL and install Ubuntu (or another linux distro), then install the CLI on that linux distro.


Did this answer your question?