Skip to content

Instantly share code, notes, and snippets.

@Aetopia
Created August 16, 2023 13:46
Show Gist options
  • Save Aetopia/452cec406a2cba78d2ac010bd527e8c5 to your computer and use it in GitHub Desktop.
Save Aetopia/452cec406a2cba78d2ac010bd527e8c5 to your computer and use it in GitHub Desktop.
Get the latest version of SCEWIN.
& {
Add-Type -AssemblyName System.Web.Extensions
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.Web.Script.Serialization.JavaScriptSerializer]$JavaScriptSerializer = New-Object System.Web.Script.Serialization.JavaScriptSerializer
[System.Net.WebClient]$WebClient = New-Object System.Net.WebClient
$WebClient.Headers.Add("user-agent", "request")
$WebClient.DownloadFile(($JavaScriptSerializer.DeserializeObject(
$WebClient.DownloadString(
"https://api.github.com/repos/dscharrer/innoextract/releases/latest"
)
)["assets"] | Where-Object { $_["name"] -like "*windows*.zip" })["browser_download_url"], "$ENV:TEMP\innoextract.zip")
Remove-Item -Path "$ENV:TEMP\innoextract" -Force -Recurse -ErrorAction SilentlyContinue
[System.IO.Compression.ZipFile]::ExtractToDirectory("$ENV:TEMP\innoextract.zip", "$ENV:TEMP\innoextract")
$WebClient.Headers.Clear()
$WebClient.Dispose()
if (Get-Command "curl.exe") {
curl.exe -#L "https://download.msi.com/uti_exe/gaming-gear/MSI-Center.zip" -o "$ENV:TEMP\MSI-Center.zip"
}
else {
$WebClient.DownloadFile("https://download.msi.com/uti_exe/gaming-gear/MSI-Center.zip", "$ENV:TEMP\MSI-Center.zip")
}
Remove-Item -Path "$ENV:TEMP\MSI-Center" -Force -Recurse -ErrorAction SilentlyContinue
[System.IO.Compression.ZipFile]::ExtractToDirectory("$ENV:TEMP\MSI-Center.zip", "$ENV:TEMP\MSI-Center")
& "$ENV:TEMP\innoextract\innoextract.exe" ((
Get-ChildItem "$ENV:TEMP\MSI-Center" -Recurse).FullName |
Where-Object { $_ -like "*.exe" }) --output-dir "$ENV:TEMP\MSI-Center"
@("*.appxbundle", "*_x64.appx") | ForEach-Object {
[string]$Pattern = $_
[System.IO.Compression.ZipFile]::ExtractToDirectory((
(Get-ChildItem "$ENV:TEMP\MSI-Center" -Recurse).FullName |
Where-Object { $_ -like $Pattern }),
"$ENV:TEMP\MSI-Center")
}
@(@("", "*SDK.exe" ),
@("DCv2", "*SDK.exe" ),
@("", "*Engine Lib*.exe") ) | ForEach-Object {
[string[]] $Array = $_
& "$ENV:TEMP\innoextract\innoextract.exe" (
(Get-ChildItem "$ENV:TEMP\MSI-Center\$( $Array[0])" -Recurse).FullName |
Where-Object { $_ -like $( $Array[1]) }) --output-dir "$ENV:TEMP\MSI-Center" }
[System.IO.Compression.ZipFile]::CreateFromDirectory(((Get-ChildItem "$ENV:TEMP\MSI-Center" -Recurse).FullName |
Where-Object { $_ -like "*SCEWIN" }),
"$ENV:USERPROFILE\Downloads\SCEWIN.zip",
[System.IO.Compression.CompressionLevel]::Optimal,
$false)
cmd.exe /c explorer.exe /select, "$ENV:USERPROFILE\Downloads\SCEWIN.zip"
}
@Aetopia
Copy link
Author

Aetopia commented Aug 16, 2023

The following script is based of this: https://github.com/amitxv/SCEWIN/blob/main/DL-SCEWIN.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment