Mountain West Farm Bureau Insurance
light shining through trees representing illumination and problem solving by lunavi
BLOG
9
2
2019
9.30.2020

Checking the Progress of Beekeeper Execution Jobs

No items found.

We have received requests to see more detail around what is happening while Beekeeper applies patches for devices.  We have built a PowerShell script to query Beekeeper and the patched devices to display what is going on within Beekeeper and show the progress on individual patches.

To execute the script, you can run it on the Beekeeper server:

PS C:\_scripts> .\BK_CheckExecutionJobs.ps1


If you wish to run this script remotely, you will need to change the “localhost” references to your Beekeeper server name: (Ex: localhost to “JFHLABBK01”)

Before edit:

$ExecutionJobsRequestURI =
"http://localhost/BeekeeperApi/OPAS.svc/PatchRecords?`$filter=Status eq 'Running'"
$RunningJobsResults = Invoke-RestMethod -Uri $ExecutionJobsRequestURI -UseDefaultCredentials -Headers $URI_Headers
If($RunningJobsResults.value.Count -gt 0)
{
Write-Host "Current Beekeeper Execution Jobs:" -ForegroundColor Yellow
Write-Host " "
Foreach($Record in $RunningJobsResults.Value)
{
If($Record.'odata.type' -eq "OPASSvc.ClusterPatchRecord")
{
$Clustersrequesturi = "http://localhost/BeekeeperApi/OPAS.svc/Clusters?`$filter=ClusterId eq " + $Record.ClusterId
$Clusterresults = Invoke-RestMethod -Uri $ClustersrequestUri -UseDefaultCredentials -Headers $URI_Headers
Write-Host " Group currently Executing: " $Clusterresults.value.ClusterName " Node count: " $Record.NodeCount -ForegroundColor Cyan
}
If($Record.'odata.type' -eq "OPASSvc.NodePatchRecord")
{
$NodeRequestURI = "http://localhost/BeekeeperApi/OPAS.svc/ClusterNodes?`$filter=NodeId eq $($Record.NodeId)"
$NodeResults = Invoke-RestMethod -Uri $NodeRequestURI -UseDefaultCredentials -Headers $URI_Headers
Write-Host " On Node: " $NodeResults.value.NodeName -ForegroundColor Green
$EventRequestURI = "http://localhost/BeekeeperApi/OPAS.svc/Events?`$filter=(NodePatchRecordId eq $($Record.RecordId))"

After edit:

$ExecutionJobsRequestURI =
"http://JFHLABBK01/BeekeeperApi/OPAS.svc/PatchRecords?`$filter=Status eq 'Running'"
$RunningJobsResults = Invoke-RestMethod -Uri $ExecutionJobsRequestURI -UseDefaultCredentials -Headers $URI_Headers
If($RunningJobsResults.value.Count -gt 0)
{
Write-Host "Current Beekeeper Execution Jobs:" -ForegroundColor Yellow
Write-Host " "
Foreach($Record in $RunningJobsResults.Value)
{
If($Record.'odata.type' -eq "OPASSvc.ClusterPatchRecord")
{
$Clustersrequesturi = "http://JFHLABBK01/BeekeeperApi/OPAS.svc/Clusters?`$filter=ClusterId eq " + $Record.ClusterId
$Clusterresults = Invoke-RestMethod -Uri $ClustersrequestUri -UseDefaultCredentials -Headers $URI_Headers
Write-Host " Group currently Executing: " $Clusterresults.value.ClusterName " Node count: " $Record.NodeCount -ForegroundColor Cyan
}
If($Record.'odata.type' -eq "OPASSvc.NodePatchRecord")
{
$NodeRequestURI = "http://JFHLABBK01/BeekeeperApi/OPAS.svc/ClusterNodes?`$filter=NodeId eq $($Record.NodeId)"
$NodeResults = Invoke-RestMethod -Uri $NodeRequestURI -UseDefaultCredentials -Headers $URI_Headers
Write-Host " On Node: " $NodeResults.value.NodeName -ForegroundColor Green
$EventRequestURI = "http://JFHLABBK01/BeekeeperApi/OPAS.svc/Events?`$filter=(NodePatchRecordId eq $($Record.RecordId))"

Once you execute the script, it will show you Beekeeper’s progress:

Another example demonstrates more detail and actual status of individual patches.

Within the detail of a device’s patches, Evaluationstate is the progress phase and Compliancestate is the installed state.

This script is in our Github repository:

https://github.com/green-house-data/BeekeeperScripts/blob/master/BK_CheckExecutionJobs.ps1

Recent Blog Posts

lunavi logo alternate white and yellow
Blog
9.30.2020
8
.
25
.
2020
Patch Automation Comparison: SCCM Orchestration Groups vs. Beekeeper

See how Beekeeper enables additional scheduling and validation functionality compared to Configuration Manager Orchestration Groups.

Learn more
lunavi logo alternate white and yellow
Blog
10.12.2020
8
.
20
.
2020
3 Reasons Ransomware Mitigation is Harder Than You Think

While dodging ransomware may seem as simple as restoring a backup, in practice a large-scale attack is a major mitigation undertaking.

Learn more
lunavi logo alternate white and yellow
Blog
10.5.2020
7
.
29
.
2020
How to Migrate Azure AD Connect to a New Server Within the Same Forest

Senior Technical Consultant Saeed Sheikh describes how to migrate your Azure AD Connect sync from a server you wish to decommission while maintaining settings and the user experience.

Learn more