Additional Doc Restructure
All checks were successful
GitOps Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 4s
GitOps Automatic Documentation Deployment / Sync Docs to https://docs.bunny-lab.io (push) Successful in 6s

This commit is contained in:
2026-01-27 05:57:50 -07:00
parent e73bb0376f
commit 886fd0db07
78 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
**Purpose**: Sometimes a Hyper-V Failover Cluster node does not want to shut down, or is having issues preventing you from migrating VMs to another node in the cluster, etc. In these situations, you can run this script to force a cluster node to reboot itself.
!!! warning "Run from a Different Server"
You absolutely do not want to run the script locally on the node that is having the issues. There are commands that can only take place if the script is ran on another node in the cluster (or another domain-joined device) logged-in with a domain administrator account.
```powershell
# PowerShell Script to Reboot a Hyper-V Failover Cluster Node and Kill clussvc
# Prompt for the hostname
$hostName = Read-Host -Prompt "Enter the hostname of the Hyper-V Failover Cluster Node"
# Output the step
Try{
Write-Host "Sending reboot command to $hostName..."
# Send the reboot command
Restart-Computer -ComputerName $hostName -Force -ErrorAction Stop
}
Catch{
Write-Host "Reboot already in queue"
}
# Output waiting
Write-Host "Waiting for 120 seconds..."
# Wait for 120 seconds
Start-Sleep -Seconds 120
# Output stoping clussvc
Write-Host "Checking if Cluster Service needs to be stopped"
# Kill the clussvc service
Invoke-Command -ComputerName $hostName -ScriptBlock {
try {
$service = Get-Service -Name clussvc
$process = Get-Process -Name $service.Name
Stop-Process -Id $process.Id -Force
} catch {
Write-Host "Error stopping clussvc: $_"
}
}
# Output the step
Write-Host "Waiting for 60 seconds..."
Start-Sleep -Seconds 60
# Kill the VMMS service
Invoke-Command -ComputerName $hostName -ScriptBlock {
try {
$service = Get-Service -Name vmms
$process = Get-Process -Name $service.Name
Stop-Process -Id $process.Id -Force
} catch {
Write-Host "Error stopping VMMS: $_"
}
}
# Output the completion
Write-Host "Reboot for $hostName should now be underway."
```

View File

@@ -0,0 +1,69 @@
**Purpose**:
This script *bumps* any replication that has entered a paused state due to a replication error. The script will record failed attempts at restarting the replication. The logs will rotate out every 5-days.
``` powershell
# Define the directory to store the log files
$logDir = "C:\ClusterStorage\Volume1\Scripts\Logs"
if (-not (Test-Path $logDir)) {
New-Item -Path $logDir -ItemType Directory
}
# Get today's date and format it for the log file name
$today = Get-Date -Format "yyyyMMdd"
$logFile = Join-Path -Path $logDir -ChildPath "ReplicationLog_$today.txt"
# Manually create the log file if it doesn't exist
if (-not (Test-Path $logFile)) {
Write-Host "Log file does not exist. Attempting creation..."
try {
New-Item -Path $logFile -ItemType File
Write-Host "Log file $logFile created successfully."
} catch {
Write-Error "Failed to create log file. Error: $_"
}
}
# Delete log files older than 5 days
Get-ChildItem -Path $logDir -Filter "ReplicationLog_*.txt" | Where-Object {
$_.CreationTime -lt (Get-Date).AddDays(-5)
} | Remove-Item
# Get a list of all nodes in the cluster
$clusterNodes = Get-ClusterNode
# Iterate over each cluster node
foreach ($node in $clusterNodes) {
try {
# Get VMs with Critical ReplicationHealth from the current node
$vmsInCriticalState = Get-VMReplication -ComputerName $node.Name | Where-Object { $_.ReplicationHealth -eq 'Critical' }
} catch {
Write-Error "Failed to retrieve VMs from Node: $($node.Name). Error: $_"
# Log the error and continue to the next node
Add-Content -Path $logFile -Value "Failed to retrieve VMs from Node: $($node.Name) at $(Get-Date)"
continue
}
foreach ($vm in $vmsInCriticalState) {
Write-Host "Checking VM: $($vm.Name) on Node: $($node.Name) for replication issues."
Write-Host "Replication State for VM: $($vm.Name) is $($vm.ReplicationState)"
# Check if the replication state is valid to resume
if ($vm.ReplicationState -eq 'Resynchronization required' -or $vm.ReplicationState -eq 'WaitingForStartResynchronize') {
Write-Warning "Replication for VM: $($vm.Name) on Node: $($node.Name) is in '$($vm.ReplicationState)' state. Skipping..."
# Log the VM that is in 'Resynchronization required' or 'WaitingForStartResynchronize' state
Add-Content -Path $logFile -Value "Replication for VM: $($vm.Name) on Node: $($node.Name) is in '$($vm.ReplicationState)' state at $(Get-Date)"
continue
}
try {
# Try to resume replication for the VM
Resume-VMReplication -VMName $vm.Name -ComputerName $node.Name
Write-Host "Resumed replication for VM: $($vm.Name) on Node: $($node.Name)"
} catch {
Write-Error "Failed to resume replication for VM: $($vm.Name) on Node: $($node.Name) - $_"
# Write the failed VM name to the log file
Add-Content -Path $logFile -Value "Failed to resume replication for VM: $($vm.Name) on Node: $($node.Name) at $(Get-Date)"
}
}
}
```