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 parameterspull/2/head
parent
1edcca9c88
commit
fd4a040d0e
|
|
@ -7,25 +7,22 @@
|
||||||
|
|
||||||
param(
|
param(
|
||||||
# Optional switch to output the generated XML files to the working directory
|
# 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 ---
|
# --- Configuration ---
|
||||||
# Category ID for the Microsoft Store app package
|
# 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.
|
||||||
$storeCategoryId = "64293252-5926-453c-9494-2d4021f1c78d"
|
$flightRing = "Retail" # Apparently accepts 'Retail', 'Internal', and 'External'
|
||||||
|
$flightingBranchName = "" # Empty ( "" ) for normal release. Otherwise apparent possible values: Dev, Beta, ReleasePreview, MSIT, CanaryChannel, external
|
||||||
# Flight Ring - Use "Retail" for the public version.
|
$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
|
||||||
# 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)
|
|
||||||
|
|
||||||
|
# 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 ---
|
# --- Define Working Directory ---
|
||||||
# Get the path to the user's personal Downloads folder in a reliable way
|
# 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
|
# Define the subfolder name for all our files
|
||||||
$subfolderName = "MSStore Install"
|
$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
|
# Combine them to create the full working directory path
|
||||||
$workingDir = Join-Path -Path $userDownloadsFolder -ChildPath $subfolderName
|
$workingDir = Join-Path -Path $userDownloadsFolder -ChildPath $subfolderName
|
||||||
|
|
||||||
|
|
@ -128,7 +130,7 @@ $fileListXmlTemplate = @"
|
||||||
</ClientPreferredLanguages>
|
</ClientPreferredLanguages>
|
||||||
<ProductsParameters>
|
<ProductsParameters>
|
||||||
<SyncCurrentVersionOnly>false</SyncCurrentVersionOnly>
|
<SyncCurrentVersionOnly>false</SyncCurrentVersionOnly>
|
||||||
<DeviceAttributes>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</DeviceAttributes>
|
<DeviceAttributes>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</DeviceAttributes>
|
||||||
<CallerAttributes>Interactive=1;IsSeeker=1;</CallerAttributes>
|
<CallerAttributes>Interactive=1;IsSeeker=1;</CallerAttributes>
|
||||||
<Products/>
|
<Products/>
|
||||||
</ProductsParameters>
|
</ProductsParameters>
|
||||||
|
|
@ -160,7 +162,7 @@ $fileUrlXmlTemplate = @"
|
||||||
<GetExtendedUpdateInfo2 xmlns="http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService">
|
<GetExtendedUpdateInfo2 xmlns="http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService">
|
||||||
<updateIDs><UpdateIdentity><UpdateID>{1}</UpdateID><RevisionNumber>{2}</RevisionNumber></UpdateIdentity></updateIDs>
|
<updateIDs><UpdateIdentity><UpdateID>{1}</UpdateID><RevisionNumber>{2}</RevisionNumber></UpdateIdentity></updateIDs>
|
||||||
<infoTypes><XmlUpdateFragmentType>FileUrl</XmlUpdateFragmentType></infoTypes>
|
<infoTypes><XmlUpdateFragmentType>FileUrl</XmlUpdateFragmentType></infoTypes>
|
||||||
<DeviceAttributes>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</DeviceAttributes>
|
<DeviceAttributes>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</DeviceAttributes>
|
||||||
</GetExtendedUpdateInfo2>
|
</GetExtendedUpdateInfo2>
|
||||||
</s:Body>
|
</s:Body>
|
||||||
</s:Envelope>
|
</s:Envelope>
|
||||||
|
|
@ -185,7 +187,7 @@ try {
|
||||||
|
|
||||||
# Step 2: Get File List
|
# Step 2: Get File List
|
||||||
Write-Host "Step 2: Getting 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)) }
|
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
|
$fileListResponse = Invoke-WebRequest -Uri $baseUri -Method Post -Body $fileListRequestPayload -Headers $headers -UseBasicParsing
|
||||||
|
|
@ -326,7 +328,7 @@ try {
|
||||||
Write-Host "Processing: $($package.FullName)"
|
Write-Host "Processing: $($package.FullName)"
|
||||||
|
|
||||||
# Get the download URL for this specific package
|
# 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
|
$fileUrlResponse = Invoke-WebRequest -Uri "$baseUri/secured" -Method Post -Body $fileUrlRequestPayload -Headers $headers -UseBasicParsing
|
||||||
$fileUrlResponseXml = [xml]$fileUrlResponse.Content
|
$fileUrlResponseXml = [xml]$fileUrlResponse.Content
|
||||||
|
|
||||||
|
|
@ -338,6 +340,10 @@ try {
|
||||||
Write-Warning " -> Could not retrieve download URL for $($package.FileName). Skipping."
|
Write-Warning " -> Could not retrieve download URL for $($package.FileName). Skipping."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if ($noDownload) {
|
||||||
|
Write-Host " -> Skipping download for $($package.FullName) because of -noDownload switch." -ForegroundColor Yellow
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
# Download the file
|
# Download the file
|
||||||
# Construct a more descriptive filename using the package's full name and its original extension
|
# 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 "An error occurred during the filtering or downloading phase:" -ForegroundColor Red
|
||||||
Write-Host $_.Exception.ToString()
|
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 ---
|
# --- Step 5: Install Downloaded Packages ---
|
||||||
Write-Host "------------------------------------------------------------"
|
Write-Host "------------------------------------------------------------"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue