PowerShell script exchange
Post Reply
nmdange
Veteran
Posts: 527
Liked: 142 times
Joined: Aug 20, 2015 9:30 pm
Contact:

Reset Hyper-V CBT with PowerShell (KB 1934)

Post by nmdange » 1 person likes this post

Recently had a support case that required resetting the CBT data on Hyper-V per this KB article https://www.veeam.com/kb1934

Since I have a large environment, doing this procedure manually on a lot of hosts was a bit of a pain, so I wrote some PowerShell to do it

I hard-coded the server names. If anyone wants to go a step further and update the script o pull the server list from Veeam, feel free :mrgreen:

Code: Select all

$servers = `
"sofs1","sofs2","sofs3",`
"hyperv1","hyperv2","hyperv3","hyperv4"

foreach($s in $servers)
{
Write-Output "Clearing CBT on " $s

Invoke-Command -ComputerName $s -ScriptBlock {
Stop-Service VeeamFCT
if(Test-Path "C:\veeamctdb.reg")
{
Remove-Item "C:\veeamctdb.reg" -Confirm:$false
}
reg export "HKLM\SYSTEM\CurrentControlSet\Services\VeeamFCT\Parameters\CTDB" C:\veeamctdb.reg
Remove-Item -Path "HKLM:SYSTEM\CurrentControlSet\Services\VeeamFCT\Parameters\CTDB" -Recurse -Confirm:$false
Start-Service VeeamFCT

}

}


veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Reset Hyper-V CBT with PowerShell (KB 1934)

Post by veremin »

Thank you for sharing your code; highly appreciated.

As to getting Hyper-V servers names automatically, the following one-liner might meet your expectations:

Code: Select all

$Servers = ((Get-VBRServer) | where {$_.Type -eq "HvServer"}).name
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests