Windows Sandboxを使ってCPUの計算時間を安全に寄付する方法
現代社会において、コンピューティングパワーは奇跡をもたらす力となっています。私たちを取り巻くさまざまな課題の解決において、計算能力は大きな役割を果たします。だからこそ、Microsoftを含むテック業界全体が、より効率的に問題を解決するための量子コンピューティングに投資しているのです。Folding@homeは、タンパク質のダイナミクスに関する分子動力学シミュレーションを実行する分散コンピューティングプロジェクトであり、新型コロナウイルスの研究などにも貢献したことで知られています。
Microsoftは、誰でも自分のPCのリソースをこのプロジェクトに寄付できる詳細なガイドを公開しています。本記事では、Windows Sandboxを利用して、CPUの計算時間を安全に寄付する方法を解説します。

Windows SandboxでCPU時間を安全に寄付する手順
Windows Sandboxは、ホストOSから完全に分離された一時的な環境を提供する機能です。この隔離された環境内でFolding@homeを動作させることで、PCのリソースを安心して寄付できます。
事前準備
作業を始める前に、以下の点を確認してください。
- Windows Sandboxが有効になっていること(Windows 10/11 Pro、Enterprise、Educationエディションでのみ利用可能)
- BIOS設定で仮想化機能(Intel VT-x / AMD-V)が有効になっていること
PowerShellスクリプトを作成する
まず、メモ帳を開き、以下のコードをコピーして貼り付けます。
#Requires -RunAsAdministrator
#For a custom username, add -username <your username> to the command execution
param([string]$username=‘wsandbox_anon‘)
$ProgressPreference = ‘SilentlyContinue‘ #Progress bar makes things way slower
# Ensure that virtualization is enabled in BIOS.
Write-Output ‘Verifying that virtualization is enabled in BIOS…‘
if ((Get-WmiObject Win32_ComputerSystem).HypervisorPresent -eq $false) {
Write-Output ‘ERROR: Please Enable Virtualization capabilities in your BIOS settings…‘
exit
}
# Determine if Windows Sandbox is enabled.
Write-Output ‘Checking to see if Windows Sandbox is installed…‘
If ((Get-WindowsOptionalFeature –FeatureName ‘Containers-DisposableClientVM‘ –Online).State -ne ‘Enabled‘) {
Write-Output ‘Windows Sandbox is not installed, attempting to install it (may require reboot)…‘
if ((Enable-WindowsOptionalFeature –FeatureName ‘Containers-DisposableClientVM‘ –All –Online –NoRestart).RestartNeeded) {
Write-Output ‘Please reboot to finish installing Windows Sandbox, then re-run this script…‘
exit
}
} else {
Write-Output ‘Windows Sandbox already installed.‘
}
# Download the latest version of FAH.
Write-Output ‘Checking for latest version of foldingathome…‘
$installer_url = ‘https://download.foldingathome.org/releases/public/release/fah-installer/windows-10-32bit/‘
# Use regex to get the latest version from the FAH website.
$version = ((Invoke-WebRequest –Uri $installer_url –UseBasicParsing).Links | Where-Object {$_.href -match ‘^v\d+([.]\d+)?‘} | ForEach-Object {[float]($_.href -replace ‘[^.\d]‘, ‘‘)} | Measure-Object –Max).Maximum
$installer = “$($installer_url)v$($version)/latest.exe“
$installer_size =(Invoke-WebRequest $installer –Method Head –UseBasicParsing).Headers.‘Content-Length‘
Write-Output “Using FAH v$version.“
# Check if the installer is present, download otherwise.
$working_dir = “$env:USERPROFILE\fah_conf“
$install_fname = ‘folding_installer.exe‘
If (!(test-path “$working_dir\$install_fname“) -or (Get-ChildItem “$working_dir\$install_fname“).Length -ne $installer_size ) {
Remove-Item “$working_dir\$install_fname“ –Force –ErrorAction SilentlyContinue
Write-Output “Downloading latest folding executable: $working_dir\$install_fname“
Write-Output “Saving to $working_dir\$install_fname…“
New-Item –ItemType Directory –Force –Path $working_dir | Out-Null
Invoke-WebRequest –Uri $installer –OutFile “$working_dir\$install_fname“
}
# Create the FAH configuration file with the Windows Sandbox FAH team #251561.
Write-Output ‘Creating init command…‘
$conf_file = ‘fah_sandbox_conf.xml‘
Write-Output “Saved [email protected] configuration file to $working_dir\$conf_file“
New-Item –Force –Path “$working_dir\$conf_file“ –ItemType File
Set-Content –Path “$working_dir\$conf_file“ –Value @”
<config>
<user v=’$username‘/>
<team v=’251561’/>
<core-priority v=’low’/>
<power v=’full’ />
<priority v=’realtime’/>
<smp v=’true’/>
<gpu v=’true’/>
<open-web-control v=’true’/>
</config>
“@
<#
Create the script that runs at logon. This script:
1. Starts the installer
2. Creates a volatile working directory
3. Copies the config into the working directory
4. Sets the firewall policies to let FAH run
5. Starts the FAH client
#>
Write-Output ‘Creating init command…‘
$logon_cmd = “$working_dir\init.cmd“
$wdg_install_dir = ‘C:\users\wdagutilityaccount\desktop\fah_conf‘
$wdg_working_dir = ‘C:\users\wdagutilityaccount\desktop\fah_working_dir‘
Write-Output “Saved logon script to $logon_cmd, this will be run upon starting Sandbox.“
New-Item –Force –Path $logon_cmd –ItemType File
Set-Content –Path $logon_cmd –Value @”
start $wdg_install_dir\$install_fname /S
goto WAITLOOP
:WAITLOOP
if exist “C:\Program Files (x86)\FAHClient\FAHClient.exe” goto INSTALLCOMPLETE
ping -n 6 127.0.0.1 > nul
goto WAITLOOP
:INSTALLCOMPLETE
mkdir $wdg_working_dir
cd $wdg_working_dir
echo \”Copying config file to $wdg_working_dir\”
copy $wdg_install_dir\$conf_file $wdg_working_dir
netsh advfirewall firewall Add rule name=”FAHClient” program=”C:\Program Files (x86)\FAHClient\FAHClient.exe” action=allow dir=out
netsh advfirewall firewall Add rule name=”FAHClient” program=”C:\Program Files (x86)\FAHClient\FAHClient.exe” action=allow dir=in
start C:\”Program Files (x86)”\FAHClient\FAHClient.exe –config $wdg_working_dir\$conf_file
“@
# Create the Sandbox configuration file with the new working dir & LogonCommand.
$sandbox_conf = “$working_dir\fah_sandbox.wsb“
Write-Output “Creating sandbox configuration file to $sandbox_conf“
New-Item –Force –Path $sandbox_conf –ItemType File
Set-Content –Path $sandbox_conf –Value @”
<Configuration>
<VGpu>Enable</VGpu>
<MappedFolders>
<MappedFolder>
<HostFolder>$working_dir</HostFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
</MappedFolders>
<LogonCommand>
<Command>$wdg_install_dir\init.cmd</Command>
</LogonCommand>
</Configuration>
“@
# For convenience, start the Sandbox.
Write-Output ‘Starting sandbox…‘
Start-Process ‘C:\WINDOWS\system32\WindowsSandbox.exe‘ –ArgumentList $sandbox_conf
スクリプトを手動で作成するのが面倒な場合は、Microsoftの公式GitHubリポジトリから直接ダウンロードすることもできます。

スクリプトを実行して寄付を開始する
準備が整ったら、あとはスクリプトをWindows PowerShell(管理者権限)で実行するだけです。自動的にWindows Sandbox環境が起動し、その中でFolding@homeクライアントが稼働して、あなたのPCのCPUリソースが分散コンピューティングプロジェクトへと寄付されます。
サンドボックスは閉じるとすべてのデータが消去される一時的な環境のため、ホストOSに一切影響を与えることなく、安全に計算リソースを提供できるのが大きなメリットです。

それでは、快適なドネーションライフを!
-
Windows 8.1でSvchost.exeがCPU使用率100%になる原因と対処法
Svchost.exeのエラーは古くからWindowsユーザーを悩ませてきた定番のトラブルで、中でもsvchost.exeがCPU使用率を100%まで消費する現象は最も頻繁に報告される問題です。Windows 8やWindows 8.1も例外ではなく、多くのユーザーが同様の症状に悩まされています。この問題が発生すると、パソコンの動作が極端に重くなり、フリーズを繰り返し、最終的にはシステムがクラッシュしてしまうこともあります。 Svchost.exeがCPU使用率100%になる原因 svchost.exeはWindows上で最も一般的なプロセスの一つであり、過剰なCPUリソースを消費する原因は
-
Windows 11で時刻を同期する3つの方法|設定・コントロールパネル・コマンドプロンプト
Windowsでは、システムクロックの時刻をサーバーと正確に同期させておくことが非常に重要です。多くのサービスやバックグラウンド処理、さらにはMicrosoft Storeなどのアプリケーションも、正常に動作するためにシステム時刻に依存しています。時刻がずれていると、これらのアプリやシステムがエラーを起こしたり、クラッシュしたりする可能性があり、さまざまなエラーメッセージが表示されることもあります。 近年のマザーボードには、PCの電源が長時間切れていても時刻を保持できるよう、専用のバッテリー(CMOSバッテリー)が搭載されています。しかし、バッテリーの劣化やOS側の不具合など、さまざまな原因に