We're Hiring!
Take the next step in your career and work on diverse technology projects with cross-functional teams.
LEARN MORE
Mountain West Farm Bureau Insurance
office workers empowered by business technology solutions
BLOG
1
3
2020
3.1.2023

Beekeeper Patch Automation: Powershell Validation Mneumonics and Recovery Actions

Last updated:
9.16.2020
3.1.2023
No items found.
beekeeper patch automation

Beekeeper, our proprietary patching automation tool, can be integrated with Powershell scripts for customized patching validation and recovery options. Read on to learn how to insert mneuomics into your script to accomplish this as well as how to recover from failed patching when detected.
 

Beekeeper Mnuemonics or Replacement Strings for PowerShell Validation Tasks

Beekeeper provides three mnemonics or replacement strings that are used to dynamically insert the cluster/node name into the script at execution time.

When a validation task is assigned to these phases:

You can use the #!nodename!#  replacement string in a PowerShell script to get the name of the node:

 

$OutTime = Get-Date

$TargetNode = "#!nodename!#"

$WarningText = "Rebooting: " + $TargetNode + " at " + $OutTime

Write-Warning $WarningText

Restart-Computer $TargetNode -Force

 

Make sure that the mnemonic is enclosed within quotes.

If you need to run a validation task during cluster or group phases such as:

You can use the #!clustername!# replacement string in a PowerShell script to get the name of the group/cluster.

SCCM – Check SCCM Agent at Cluster Start.ps1 in our github repository serves as an example on how to use the cluster/group name for Application Groups, Windows Failover Clusters, and Exchange DAGs.

The #!entityname!# would be used when the type (node/cluster) and is not important.
 

Patching failure recovery actions as PowerShell Validation Tasks

When patching execution jobs fail, you may need to recover services and such.  Beekeeper provides the “On Node Failure” and “On Group/Cluster Failure” validation task phases.

If a node belonging to an  Application Group fails to apply an update, it will be marked as failed and execute the “On Node Failure” phase if you have assigned a validation task to the phase.  An example would be to restart a service or even reboot that node. 

Windows Service example:

$Nodename = "#!nodename!#"

$SvcStatus = Get-Service "My Service" -ComputerName $NodeName 

$WarningText = $NodeName + " My Service Status: " + $SvcStatus.Status

Write-Warning $WarningText

If ($SvcStatus.Status -ne "Running")

   {

    Get-Service "My Service" -ComputerName $NodeName | Restart-Service | Out-Null

    $WarningText = $NodeName + " My Service Started"

    Write-Warning $WarningText

   }

This code uses the Beekeeper string replacement #!nodename!# to get the node that failed, and then uses “Write-Warning” cmdlet to get the output into the Beekeeper execution log.

Reboot-Node.ps1 in our github repository serves as an example on how to reboot and wait for the node to resume as a validation task. 

If you need to execute the same recovery action on all members of the Application Group, Windows Failover Cluster, or Exchange DAG, you can use the SCCM – Check SCCM Agent at Cluster Start.ps1 in our github repository serves as an example on how to run code against each member of the Application Group, Windows Failover Cluster, or Exchange DAG.

Recent Blog Posts

lunavi logo alternate white and yellow
3.27.2024
03
.
27
.
2024
Utilizing Bicep Parameter Files with ALZ-Bicep

Ready to achieve more efficient Azure Deployments? You can use Bicep parameters instead of JSON which opens new opportunities for deployment. Let Lunavi expert, Joe Thompson, show you how.

Learn more
lunavi logo alternate white and yellow
3.26.2024
03
.
04
.
2024
Anticipating Surges in Cyber Attacks and Bolstering Your InfoSec Defenses in 2024

Learn how to navigate 2024 with the right InfoSec defenses to protect your organization against a rising number of cyber attacks.

Learn more
lunavi logo alternate white and yellow
3.26.2024
01
.
03
.
2024
Microsoft Copilot is Re-Shaping the Innovation Frontier

Microsoft 365 Copilot has been released, and it's changing the way we work. More than OpenAI or ChatGPT, read how Copilot can seamlessly integrate with your workflow.

Learn more