mattiasc85 / scripts Goto Github PK
View Code? Open in Web Editor NEWA mix of scripts/tools I've made, put together or simply found online
A mix of scripts/tools I've made, put together or simply found online
Hi. I just stumble upon your script and it works perfectly. However, it only downloads one single link at once. Is it possible that you can write a script that batch download the appx files? Thanks in advance.
In the script is this quote
There's this "small" issue with deploying .Appx and AppxBundles during an OSD.
But that script will be done and uploaded in a cuple of days or so. :)
However I don't see this script in the OSD folder, have you still got a copy of the install script?
I can open the store.rg-adguard.net website and use it in a browser just fine, but this script (which has worked like a champ for years) now just gives me a "(403) Forbidden" error (see below).
I have only a rudimentary understanding of Powershell, but I tried adding a referer URI to the headers using $wchttp.Headers[[System.Net.HttpRequestHeader]::Referer]="https://store.rg-adguard.net/"
and (separately) $wchttp.Headers.Add("Origin", "https://store.rg-adguard.net/")
but that made no difference. ๐
I know that this may not be fixable from this side of the equation since the error is generated server-side, but I am hoping that other people far smarter than I am will figure out how to get around this.
Thanks!
Exception calling "UploadString" with "2" argument(s): "The remote server returned an error: (403) Forbidden."
At C:\Users\[REDACTED]\Desktop\Download-AppxFromStore.ps1:60 char:1
+ $HtmlResult = $wchttp.UploadString($URI, $myParameters)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
There is a problem with the logic behind Download-AppxFromStore.ps1, it's not just downloading the latest version of the appx + all the dependencies, it's actually downloading all the old versions of the app itself too!
In this example app it ended up downloading 2.9GB of old versions that I had to delete, waste of time and bandwidth.
If %tmp% starts with a lower-case letter then this script fails:
https://github.com/MattiasC85/Scripts/blob/master/OSD/Download-AppxFromStore.ps1
This is most easily demonstrated using the -SavePathRoot parameter:
Download-AppxFromStore.ps1 -StoreURL https://www.microsoft.com/en-us/p/windbg-preview/9pgjgd53tn86 -SavePathRoot c:\src\temp
Invalid characters in path c:\src\temp\9pgjgd53tn86
Download-AppxFromStore.ps1 -StoreURL https://www.microsoft.com/en-us/p/windbg-preview/9pgjgd53tn86 -SavePathRoot C:\src\temp
Downloading Microsoft.WinDbg_1.2001.2001.0_neutral__8wekyb3d8bbwe.BlockMap...
Downloading Microsoft.WinDbg_1.2001.2001.0_neutral__8wekyb3d8bbwe.appx...
Download is complete...
Opening Folder
I'd submit a PR but I can't decode the regex or its intent.
Please add the following:
Tried to use it to download WinDbg
https://apps.microsoft.com/store/detail/windbg-preview/9PGJGD53TN86
It doesn't download anything because textContent which is supposed to be file name (I think?) is empty.
Windows 11 pro 64 bit
Output of the script (modified a litle to print $Download instead of $Download.textContent)
PS E:\Downloads> powershell -ExecutionPolicy ByPass -File Download-AppxFromStore.ps1 https://apps.microsoft.com/store/detail/windbg-preview/9PGJGD53TN86
Downloading @{textContent=; href=http://dl.delivery.mp.microsoft.com/filestreamingservice/files/d37438d0-56af-4b7a-b437-b000b6195d8a}...
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At E:\Downloads\Download-AppxFromStore.ps1:122 char:67
+ ... ($Download.href, "$SavePathRoot\$ProductID\$($Download.textContent)")
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Downloading @{textContent=; href=http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/4c032be9-8e5e-490e-9d84-3eb4392501ad?P1=1676177949&P2=404&P3=2&P4=EtCOJHGi2fAWM56%2flPJlqNfz6Fpg9QViwOeJQK2DSyZxf6%2bh6PNzkxzmoudmMuYkiQrHJwi%2bJcED0dCBTit9eA%3d%3d}...
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At E:\Downloads\Download-AppxFromStore.ps1:122 char:67
+ ... ($Download.href, "$SavePathRoot\$ProductID\$($Download.textContent)")
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Downloading @{textContent=; href=http://dl.delivery.mp.microsoft.com/filestreamingservice/files/408eeab8-5c65-4246-8f8b-c541e86b88fe}...
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At E:\Downloads\Download-AppxFromStore.ps1:122 char:67
+ ... ($Download.href, "$SavePathRoot\$ProductID\$($Download.textContent)")
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Downloading @{textContent=; href=http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/978feae8-9dfb-448a-af1a-f85fa96fd5ab?P1=1676178449&P2=404&P3=2&P4=TiQu6veH5nVRDNnSwepT%2bbQ9BaGtoa7azsrNTOZ%2fh%2b0NffZXUbXdAVhTqKvSC%2fkx3gTgJv7LFXAzVXOPckcsDw%3d%3d}...
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At E:\Downloads\Download-AppxFromStore.ps1:122 char:67
+ ... ($Download.href, "$SavePathRoot\$ProductID\$($Download.textContent)")
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Downloading @{textContent=; href=http://dl.delivery.mp.microsoft.com/filestreamingservice/files/09375dd6-cccd-4f82-9d76-06fd9810ec89}...
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At E:\Downloads\Download-AppxFromStore.ps1:122 char:67
+ ... ($Download.href, "$SavePathRoot\$ProductID\$($Download.textContent)")
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Downloading @{textContent=; href=http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/3add0143-11b3-48fe-85e8-02f9b58b2850?P1=1676187649&P2=404&P3=2&P4=mCXHXWOcM4Lw9NwWgOQPgVPz6ZHYc7ABwD2MY%2f25RwMVVPtvqe%2bZRqehAZrFgqmpsxCH19RUBAJKP0dh2bxuHQ%3d%3d}...
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At E:\Downloads\Download-AppxFromStore.ps1:122 char:67
+ ... ($Download.href, "$SavePathRoot\$ProductID\$($Download.textContent)")
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
---------------------------------------
Download is complete...
Opening Folder
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.