From fd4a040d0e04b9df552b682ec0d7e52e53ddcbb0 Mon Sep 17 00:00:00 2001
From: ThioJoe <12518330+ThioJoe@users.noreply.github.com>
Date: Mon, 4 Aug 2025 20:31:43 -0700
Subject: [PATCH] Update Install-Microsoft-Store.ps1
- Add variables for flight ring, branch name, etc in requests, though haven't figured out if they even work.
- Add some script parameters
---
Installer Scripts/Install-Microsoft-Store.ps1 | 53 ++++++++++++-------
1 file changed, 34 insertions(+), 19 deletions(-)
diff --git a/Installer Scripts/Install-Microsoft-Store.ps1 b/Installer Scripts/Install-Microsoft-Store.ps1
index 2146cc5..fe21498 100644
--- a/Installer Scripts/Install-Microsoft-Store.ps1
+++ b/Installer Scripts/Install-Microsoft-Store.ps1
@@ -7,25 +7,22 @@
param(
# Optional switch to output the generated XML files to the working directory
- [switch]$debugSaveFiles
+ [switch]$debugSaveFiles,
+ # Optional switch to skip the installation of Microsoft Store, but still download the files
+ [switch]$noInstall,
+ # Optional switch to skip the download and install, but still show the packages found
+ [switch]$noDownload
)
# --- Configuration ---
-# Category ID for the Microsoft Store app package
-$storeCategoryId = "64293252-5926-453c-9494-2d4021f1c78d"
-
-# Flight Ring - Use "Retail" for the public version.
-# Note: Values other than retail are not properly set up yet in this script
-$flightRing = "Retail"
-
-# Other Known options:
-# "RP" (ReleasePreview Branch)
-# "WIS" (Beta Branch)
-# "WIF" (Dev Branch)
-# Other Possible Options, Untested:
-# "Canary"
-# "MSIT" (Internal)
+# Note: These defaults should work for the regular current build of Microsoft Store, but I haven't tested using any of the other values. So fetching insider builds of MS Store (if any) might not work.
+$flightRing = "Retail" # Apparently accepts 'Retail', 'Internal', and 'External'
+$flightingBranchName = "" # Empty ( "" ) for normal release. Otherwise apparent possible values: Dev, Beta, ReleasePreview, MSIT, CanaryChannel, external
+$currentBranch = "ge_release" # "rs_prerelease" for insider, "ni_release" for normal release on Windows build below 26100, "ge_release" for normal release equal or above 26100
+# Random Notes:
+# flightRing should be "Internal" if flightingBranchName is "MSIT"
+# MAYBE need flightRing as "External" if setting flightingBranchName anything besides empty or MSIT?
# --- Define Working Directory ---
# Get the path to the user's personal Downloads folder in a reliable way
@@ -34,6 +31,11 @@ $userDownloadsFolder = (New-Object -ComObject Shell.Application).Namespace('shel
# Define the subfolder name for all our files
$subfolderName = "MSStore Install"
+# Category ID for the Microsoft Store app package
+$storeCategoryId = "64293252-5926-453c-9494-2d4021f1c78d"
+
+$flightingBranchName = $currentBranch
+
# Combine them to create the full working directory path
$workingDir = Join-Path -Path $userDownloadsFolder -ChildPath $subfolderName
@@ -128,7 +130,7 @@ $fileListXmlTemplate = @"
false
- E:BranchReadinessLevel=CB&CurrentBranch=rs_prerelease&OEMModel=Virtual%20Machine&FlightRing=Retail&AttrDataVer=321&InstallLanguage=en-US&OSUILocale=en-US&InstallationType=Client&FlightingBranchName=&OSSkuId=48&App=WU_STORE&ProcessorManufacturer=GenuineIntel&OEMName_Uncleaned=Microsoft%20Corporation&AppVer=1407.2503.28012.0&OSArchitecture=AMD64&IsFlightingEnabled=1&TelemetryLevel=1&DefaultUserRegion=39070&WuClientVer=1310.2503.26012.0&OSVersion=10.0.26100.3915&DeviceFamily=Windows.Desktop
+ E:BranchReadinessLevel=CB&CurrentBranch={2}&OEMModel=Virtual%20Machine&FlightRing={3}&AttrDataVer=321&InstallLanguage=en-US&OSUILocale=en-US&InstallationType=Client&FlightingBranchName={4}&OSSkuId=48&App=WU_STORE&ProcessorManufacturer=GenuineIntel&OEMName_Uncleaned=Microsoft%20Corporation&AppVer=1407.2503.28012.0&OSArchitecture=AMD64&IsFlightingEnabled=1&TelemetryLevel=1&DefaultUserRegion=39070&WuClientVer=1310.2503.26012.0&OSVersion=10.0.26100.3915&DeviceFamily=Windows.Desktop
Interactive=1;IsSeeker=1;
@@ -160,7 +162,7 @@ $fileUrlXmlTemplate = @"
{1}{2}
FileUrl
- E:BranchReadinessLevel=CB&CurrentBranch=rs_prerelease&OEMModel=Virtual%20Machine&FlightRing={3}&AttrDataVer=321&InstallLanguage=en-US&OSUILocale=en-US&InstallationType=Client&FlightingBranchName=&OSSkuId=48&App=WU_STORE&ProcessorManufacturer=GenuineIntel&OEMName_Uncleaned=Microsoft%20Corporation&AppVer=1407.2503.28012.0&OSArchitecture=AMD64&IsFlightingEnabled=1&TelemetryLevel=1&DefaultUserRegion=39070&WuClientVer=1310.2503.26012.0&OSVersion=10.0.26100.3915&DeviceFamily=Windows.Desktop
+ E:BranchReadinessLevel=CB&CurrentBranch={3}&OEMModel=Virtual%20Machine&FlightRing={4}&AttrDataVer=321&InstallLanguage=en-US&OSUILocale=en-US&InstallationType=Client&FlightingBranchName={5}&OSSkuId=48&App=WU_STORE&ProcessorManufacturer=GenuineIntel&OEMName_Uncleaned=Microsoft%20Corporation&AppVer=1407.2503.28012.0&OSArchitecture=AMD64&IsFlightingEnabled=1&TelemetryLevel=1&DefaultUserRegion=39070&WuClientVer=1310.2503.26012.0&OSVersion=10.0.26100.3915&DeviceFamily=Windows.Desktop
@@ -185,7 +187,7 @@ try {
# Step 2: Get File List
Write-Host "Step 2: Getting file list..."
- $fileListRequestPayload = $fileListXmlTemplate -f $encryptedCookieData, $storeCategoryId, $flightRing
+ $fileListRequestPayload = $fileListXmlTemplate -f $encryptedCookieData, $storeCategoryId, $currentBranch, $flightRing, $flightingBranchName
If ($debugSaveFiles) { [System.IO.File]::WriteAllText((Join-Path $LogDirectory "02_Step2_Request_AUTOMATED.xml"), $fileListRequestPayload, [System.Text.UTF8Encoding]::new($false)) }
$fileListResponse = Invoke-WebRequest -Uri $baseUri -Method Post -Body $fileListRequestPayload -Headers $headers -UseBasicParsing
@@ -326,7 +328,7 @@ try {
Write-Host "Processing: $($package.FullName)"
# Get the download URL for this specific package
- $fileUrlRequestPayload = $fileUrlXmlTemplate -f $encryptedCookieData, $package.UpdateID, $package.RevisionNumber, $flightRing
+ $fileUrlRequestPayload = $fileUrlXmlTemplate -f $encryptedCookieData, $package.UpdateID, $package.RevisionNumber, $currentBranch, $flightRing, $flightingBranchName
$fileUrlResponse = Invoke-WebRequest -Uri "$baseUri/secured" -Method Post -Body $fileUrlRequestPayload -Headers $headers -UseBasicParsing
$fileUrlResponseXml = [xml]$fileUrlResponse.Content
@@ -338,6 +340,10 @@ try {
Write-Warning " -> Could not retrieve download URL for $($package.FileName). Skipping."
continue
}
+ if ($noDownload) {
+ Write-Host " -> Skipping download for $($package.FullName) because of -noDownload switch." -ForegroundColor Yellow
+ continue
+ }
# Download the file
# Construct a more descriptive filename using the package's full name and its original extension
@@ -366,6 +372,15 @@ try {
Write-Host "An error occurred during the filtering or downloading phase:" -ForegroundColor Red
Write-Host $_.Exception.ToString()
}
+
+ If ($noDownload) {
+ Write-Host "Skipping download step because of -noDownload switch." -ForegroundColor Yellow
+ return
+ }
+ If ($noInstall) {
+ Write-Host "Skipping installation step because of -noInstall switch." -ForegroundColor Yellow
+ return
+ }
# --- Step 5: Install Downloaded Packages ---
Write-Host "------------------------------------------------------------"