Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Restart Local Folding@Home Client
<#
Name: Restart Folding@Home
Author: Bryan Vine
Date: 3/25/2020
Description: Restarts the local Folding @ Home client while cleaning out existing work to reset the connection countdown timer.
Notes: It will remove all existing work, so make sure you only run this if it's stuck in waiting for download.
Link: https://www.bryanvine.com/2020/03/covid-19-finding-cure-with-foldinghome.html
#>
#Requires -Version 3.0
if(Get-Service -name "*Folding@Home*"){
Get-Service -name "*Folding@Home*" | Stop-Service -Verbose
}else{
Get-Process -Name FAHClient -ErrorAction SilentlyContinue| Stop-Process -Verbose
}
Start-Sleep -Seconds 3
Push-Location
if(!(dir "C:\Users\$($env:USERNAME)\AppData\Roaming\FAHClient\work\" -directory)){
Remove-Item "C:\Users\$($env:USERNAME)\AppData\Roaming\FAHClient\work\client.db*" -Force -Verbose
}
if(Get-Service -name "*Folding@Home*"){
Get-Service -name "*Folding@Home*" | Start-Service -Verbose
Write-Verbose "Started FAHClient Service" -Verbose
}else{
cd "C:\Users\$($env:USERNAME)\AppData\Roaming\FAHClient"
. "C:\Program Files (x86)\FAHClient\HideConsole.exe" "C:\Program Files (x86)\FAHClient\FAHClient.exe"
Write-Verbose "Started FAHClient" -Verbose
}
Pop-Location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment