Reset Hyper-V CBT with PowerShell (KB 1934)

PowerShell script exchange

Reset Hyper-V CBT with PowerShell (KB 1934)

Veeam Logoby nmdange » Thu Jul 28, 2016 3:51 pm 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

}

}


nmdange
Expert
 
Posts: 193
Liked: 57 times
Joined: Thu Aug 20, 2015 9:30 pm

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

Veeam Logoby v.Eremin » Thu Jul 28, 2016 4:34 pm

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
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 2 guests