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
!
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.
Install-Module -Name 'KnowBe4-Partner'
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.
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
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
If you have a suggestion that would make this better, please fork the repo and create a pull request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/CoolFeature
) - Commit your Changes (
git commit -m 'Add some CoolFeature'
) - Push to the Branch (
git push origin feature/CoolFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.