Skip to content

Instantly share code, notes, and snippets.

@jsmcnair
Last active June 13, 2021 02:25
Show Gist options
  • Save jsmcnair/d852258509e4c75751ffebf35e9947a5 to your computer and use it in GitHub Desktop.
Save jsmcnair/d852258509e4c75751ffebf35e9947a5 to your computer and use it in GitHub Desktop.
PowerShell Cinebench score generator
function Get-CinebenchScore {
$source = "http://http.maxon.net/pub/cinebench/CinebenchR20.zip"
$out = "C:\CinebenchR20.zip"
$cbfolder = "C:\cinebench\"
$cbpath = Join-Path $cbfolder "cinebench.exe"
$log = Join-Path $cbfolder "log.txt"
if(-not (Test-Path $cbpath)) {
# Download
Invoke-WebRequest -Uri $source -OutFile $out
# Unpack
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($out, $cbfolder)
}
# Run cinebench
Start-Process -FilePath $cbpath -ArgumentList "g_CinebenchCpuXTest=true g_acceptDisclaimer=true" -RedirectStandardOutput $log -Wait
# Get score
return ((Get-Content $Log -Tail 5 |
Where-Object { $_ -like "CB*" }) -split " ")[1]
}
# Run once
# Get-CinebenchScore
# Average of 3
1..3 | Foreach-Object { Get-CinebenchScore } | Measure-Object -Average
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment