Skip to content

greenloop-it-solutions/KnowBe4-Partner

Repository files navigation


Logo

KnowBe4 Partner

A PowerShell Module for the KnowBe4 Partner Portal
Explore the docs »

Forks Issues MIT License PS Gallery

Report Bug · Request Feature

About

The KnowBe4 Partner module was created to interact with undocumented API/GraphQL calls to streamline and automate processes. This module is in no way complete and is currently in progress!

Getting Started

This module currently uses SAML Single Sign-On authentication and has only been tested with Azure as the Identity Provider. This should work with other providers that return a SAML response.

The PS-SAML-Interactive module is currently used for obtaining a SAML response.

Installation

Install-Module -Name 'KnowBe4-Partner'

Usage

Run the initial connect command:

Connect-KB4PartnerAccount -EmailAddress '[email protected]'

Request all managed accounts or search for a specific client:

$result = Get-KB4ManagedAccount -Search 'Initech'
$ownerId = $result.accounts.nodes.accountOwner.id

Currently, this returns a nested object that contains an important Id: accountOwner > id.

You will need this Id to sign into a client account:

Set-KB4ClientContext -AccountOwnerId $ownerId

Once signed in, all commands will execute in the current client context.

To change the client context, run a new search or disconnect the client session manually:

Disconnect-KB4ClientSession

There's probably a better way to handle this but for now, either option will work.

For a complete list of commands, please refer to the documentation.

Example 1

Create a remedial training campaign:

$trainingCampaign = @{
    Name                    = "Remedial Training"
    AutoEnroll              = 'true'
    StartCampaignAtDate     = "2022-11-16"
    StartCampaignAtTime     = "08:00"
    EndCampaignAtDate       = 'null'
    EndCampaignAtTime       = 'null'
    TimeZone                = 'PACIFIC_TIME_US_CANADA'
    EnrollmentDuration      = 1
    EnrollmentDurationType  = "WEEKS"
    ResetAutoEnrollments    = 'true'
    AllowPastDueCompletions = 'false'
    AllowSurveys            = 'false'
    AllowSurveyComments     = 'false'
    TrackScores             = 'true'
    SelectedContent         = 4113634
    SelectedGroups          = 3590820
    RemovePassedFromGroups  = 3590820
    AddPassedToGroups       = 0
    AllUsers                = 'false'
    EndCampaignOption       = "RELATIVE"
}

New-KB4TrainingCampaign @trainingCampaign

Example 2

Create a phishing campaign:

$phishingCampaign = @{
    BusinessDays               = 1,2,3,4,5
    BusinessHoursEndHour       = '17:00'
    BusinessHoursStartHour     = '08:00'
    TimeZone                   = 'PACIFIC_TIME_US_CANADA'
    ClickedGroupId             = 3590820
    Name                       = 'Phishing Campaign'
    FrequencyPeriod            = 'BIWEEK'
    NextRunDate                = '2022-11-16'
    NextRunTime                = '15:30'
    SelectedTemplateCategories = 1252
    ReplyDomainPrefix          = 43
    ReplyPhishDomainId         = 'contoso'
    StoreReplyContent          = 'true'
    TrackReplies               = 'true'
}

New-KB4PhishingCampaign @phishingCampaign

Contributing

If you have a suggestion that would make this better, please fork the repo and create a pull request.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/CoolFeature)
  3. Commit your Changes (git commit -m 'Add some CoolFeature')
  4. Push to the Branch (git push origin feature/CoolFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

About

A PowerShell Module for the KnowBe4 Partner Portal

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published