Install and Use Snyk CLI on Windows

This tutorial intends to teach you to Install and Use Snyk CLI on Windows.

The Snyk command line interface (CLI) is a good choice to find and scan your source code for security vulnerabilities. You can follow the steps to install Snyk CLI on your Windows by using the Scoop package manager.

Also, you can use these installation steps on both Windows 10 and Windows 11.

Steps To Install and Use Snyk CLI on Windows

To set up Snyk CLI, you must log in to your Windows Client which is Windows 10 or Windows 11, and follow the steps below.

Step 1 – Run PowerShell on Windows

The first step is to run your PowerShell as an administrator. In your search bar type PowerShell and right-click on it and choose Run as an Administrator.

For more information, you can visit this guide Run PowerShell as Administrator on Windows.

Step 2 – Install Scoop on Windows

At this point, you must have installed the Scoop package manager to set up your Snyk CLI.

From your PowerShell console, run the following command to set the permission to install Scoop:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

You will be asked to:

Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y

Simply type “y” and continue.

Then, download and install the Scoop by using the following installer script:

Invoke-Expression "& {$(Invoke-RestMethod get.scoop.sh)} -RunAsAdmin"

When your installation is completed, you will get the following output:

Output
Initializing...
Downloading ...
Extracting...
Creating shim...
Adding ~\scoop\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.

Now you have Scoop package manager installed on your Windows.

If you want more information about Scoop, you can check this guide on Install and Use Scoop on Windows.

Step 3 – Install Snyk on Windows

At this point, you can easily set up your Snyk CLI. To do this, follow the steps below:

First, you install git by using the Scoop command:

 scoop install git

Then, use the following Scoop command to add the Snyk bucket on your Windows system:

scoop bucket add snyk https://github.com/snyk/scoop-snyk

Finally, use the following command to install Snyk:

scoop install snyk

When your installation is completed, you will get the following output:

Output
Installing 'snyk' (1.1159.0) [64bit] from snyk bucket
snyk-win.exe (60.1 MB) [======================================================================================] 100%
Checking hash of snyk-win.exe ... ok.
Linking ~\scoop\apps\snyk\current => ~\scoop\apps\snyk\1.1159.0
Creating shim for 'snyk'.
'snyk' (1.1159.0) was installed successfully!

Also, you can verify your Snyk installation by checking its version:

snyk --version
Output
1.1159.0

Step 4 – Test Snyk CLI on Windows

To get full information about Snyk, from your PowerShell simply run the following command:

snyk

You should get the following output:

Output
CLI help
  Snyk CLI scans and monitors your projects for security vulnerabilities and license issues.

  For more information visit the Snyk website https://snyk.io

  For details see the CLI documentation https://docs.snyk.io/features/snyk-cli

How to get started
  1. Authenticate by running snyk auth
  2. Test your local project with snyk test
  3. Get alerted for new vulnerabilities with snyk monitor

Available commands
  To learn more about each Snyk CLI command, use the --help option, for example, snyk auth --help.

  Note: The help on the docs site is the same as the --help in the CLI.

  snyk auth
    Authenticate Snyk CLI with a Snyk account.

  snyk test
    Test a project for open source vulnerabilities and license issues.

    Note: Use snyk test --unmanaged to scan all files for known open source dependencies (C/C++
    only).

  snyk monitor
    Snapshot and continuously monitor a project for open source vulnerabilities and license issues.

  snyk container
    Test container images for vulnerabilities.

  snyk iac
    Commands to find and manage security issues in Infrastructure as Code files.

  snyk code
    Find security issues using static code analysis.

  snyk sbom
    Produce an SBOM for a local software project in an ecosystem supported by Snyk.

  snyk log4shell
    Find Log4Shell vulnerability.

  snyk config
    Manage Snyk CLI configuration.

  snyk policy
    Display the .snyk policy for a package.

  snyk ignore
    Modify the .snyk policy to ignore stated issues.

Debug
  Use -d option to output the debug logs.

Configure the Snyk CLI
  You can use environment variables to configure the Snyk CLI and also set variables to configure the
  Snyk CLI to connect with the Snyk API. See Configure the Snyk CLI
  https://docs.snyk.io/features/snyk-cli/configure-the-snyk-cli

As you can see from the output, you can easily use Snyk to authenticate your Snyk CLI with a Snyk account, Test your projects, and Monitor your projects for vulnerabilities and issues.

For more information, you can visit the Snyk CLI Documentation.

Conclusion

At this point, you have learned to Install Snyk CLI by using the Scoop package manager on Windows. First, you have installed Scoop with an installer script, then, add the Snyk bucket to Scoop, and easily install your Snyk CLI. Also, you have learned to use Snyk to authenticate your Snyk CLI and start your monitoring and scanning.

Hope you enjoy it. You may be like these articles on the orcacore website:

Enable Network Discovery and File Sharing on Windows

Install Chocolatey or Choco on Windows

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!