Skip to content

Instantly share code, notes, and snippets.

@haridhayal11
Last active July 9, 2024 19:13
Show Gist options
  • Save haridhayal11/663799a46ea3608c0ea0a07773cca34f to your computer and use it in GitHub Desktop.
Save haridhayal11/663799a46ea3608c0ea0a07773cca34f to your computer and use it in GitHub Desktop.
steam-update-no-admin
# Steam Installer Downloader and Extractor Script
# Define the URLs and file paths
$steamUrl = "https://cdn.akamai.steamstatic.com/client/installer/SteamSetup.exe"
$steamPath = "$env:USERPROFILE\Downloads\SteamSetup.exe"
$extractPath = "$env:USERPROFILE\Downloads\SteamSetup_Extracted"
# Function to download a file
function Download-File($url, $outputPath) {
Write-Host "Downloading from $url..."
try {
Invoke-WebRequest -Uri $url -OutFile $outputPath -ErrorAction Stop
Write-Host "Download completed successfully."
return $true
} catch {
Write-Host "Failed to download: $_"
return $false
}
}
# Download Steam installer
if (-not (Download-File $steamUrl $steamPath)) {
Write-Host "Failed to download Steam installer. Exiting script."
return
}
# Create extraction directory
New-Item -ItemType Directory -Force -Path $extractPath | Out-Null
# Extract Steam installer using 7-Zip
Write-Host "Extracting Steam installer..."
try {
$process = Start-Process -FilePath "7z" -ArgumentList "x", "`"$steamPath`"", "-o`"$extractPath`"", "-y" -NoNewWindow -PassThru -Wait
if ($process.ExitCode -ne 0) {
throw "7-Zip exited with code $($process.ExitCode)"
}
Write-Host "Extraction completed successfully."
} catch {
Write-Host "Failed to extract Steam installer: $_"
}
# Provide information to the user
Write-Host "Steam installer has been downloaded to: $steamPath"
Write-Host "Contents have been extracted to: $extractPath"
Write-Host "You can examine the extracted files to see the contents of the Steam installer."
Write-Host "To install Steam, you can run the original 'SteamSetup.exe' file."
Write-Host "For a silent installation, you can run it with the '/S' parameter from a command prompt or PowerShell."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment