# Обновление ProcessHacker с https://github.com/VictorVG/ph # Обновляются обе версии x86 и x64 которые находятся в соответствующих подпапках x86 и x64 в той же папке, где и скрипт. # Настройки не переписываются. # Для работы требуется 7za.exe $sevenzip = "7za.exe" $phurl = "https://github.com/VictorVG/ph" $phraw = "https://github.com/VictorVG/ph/raw/master/processhacker-3.0-bin.zip" $MyInvocation.MyCommand.Path | Split-Path -Parent | Set-Location [System.Net.ServicePointManager]::SecurityProtocol = 'SSL3,TLS,TLS11,TLS12' $web = Invoke-WebRequest -URI $phurl $phlink = "" $phrelease = "" foreach( $c in $web.content ) { if ( $phlink -eq "" -and $c -match 'href="(/[^"]+/processhacker-[\d.]+-bin.zip)"' ) { $phlink = $phraw } if ( $phlink -ne "" -and $phrelease -eq "" -and $c -match ">v([\d.]+) Git-[\da-f]+<" ) { $phrelease = $Matches[1] } if ($phlink -and $phrelease ) { Write-Host "RELEASE: $phrelease" Write-Host "LINK: $phlink" $release32 = if(Test-Path -Lit "x86\ProcessHacker.exe") {(Get-ItemProperty "x86\ProcessHacker.exe").VersionInfo.FileVersion} else {""} $release64 = if(Test-Path -Lit "x64\ProcessHacker.exe") {(Get-ItemProperty "x64\ProcessHacker.exe").VersionInfo.FileVersion} else {""} Write-Host "Current release x32: $release32" Write-Host "Current release x64: $release64" if ($release32 -ne $phrelease -or $release64 -ne $phrelease) { Write-Host "Update ProcessHacker" $pharch = [System.IO.Path]::GetFileName($phlink) Invoke-WebRequest $phlink -Out $pharch if (Test-Path -Lit $pharch) { Remove-Item "x86\plugins" -Recurse -Force -EA SilentlyContinue Remove-Item "x64\plugins" -Recurse -Force -EA SilentlyContinue Remove-Item "x64\x86" -Recurse -Force -EA SilentlyContinue & $sevenzip x -y -r "-x!*.xml" "-x!*.txt" -- $pharch * | Out-Null } Remove-Item $pharch -Force Write-Host "Done" } break } } |