Replies: 1 comment 13 replies
-
Hello, if I remember correctly, this app is installed out-of-the-box. Why you need to install is again py parsing the site? :) Anyway, here is the fucntion for you. I do not consider adding it to the module. <#
.SYNOPSIS
Install "Microsoft To Do: Lists, Tasks & Reminders"
.PARAMETER Install
Download and install the "Microsoft To Do: Lists, Tasks & Reminders" extension using the https://store.rg-adguard.net parser
.PARAMETER Manually
Open Microsoft Store "Microsoft To Do: Lists, Tasks & Reminders" page to install the extension manually
.EXAMPLE
MicrosoftToDo -Install
.EXAMPLE
MicrosoftToDo -Manually
.LINK
https://www.microsoft.com/store/productId/9NBLGGH5R558
.LINK
https://dev.to/kaiwalter/download-windows-store-apps-with-powershell-from-https-store-rg-adguard-net-155m
.NOTES
The extension can be installed without Microsoft account
.NOTES
Current user
#>
function MicrosoftToDo
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Install"
)]
[switch]
$Install,
[Parameter(
Mandatory = $true,
ParameterSetName = "Manually"
)]
[switch]
$Manually
)
switch ($PSCmdlet.ParameterSetName)
{
"Install"
{
# Check whether the extension is already installed
if (-not (Get-AppxPackage -Name Microsoft.Todos))
{
try
{
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
try
{
# Check whether the https://store.rg-adguard.net site is alive
$Parameters = @{
Uri = "https://store.rg-adguard.net/api/GetFiles"
Method = "Head"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
$Parameters = @{
Method = "Post"
Uri = "https://store.rg-adguard.net/api/GetFiles"
ContentType = "application/x-www-form-urlencoded"
Body = @{
type = "url"
# HEVC Video Extensions from Device Manufacturer
url = "https://www.microsoft.com/store/productId/9NBLGGH5R558"
ring = "Retail"
lang = "en-US"
}
UseBasicParsing = $true
}
$Raw = Invoke-WebRequest @Parameters
# Parsing the page
$Raw | Select-String -Pattern '<tr style.*<a href=\"(?<url>.*)"\s.*>(?<text>.*)<\/a>' -AllMatches | ForEach-Object -Process {$_.Matches} | ForEach-Object -Process {
$TempURL = $_.Groups[1].Value
$Package = $_.Groups[2].Value
if ($Package -like "Microsoft.Todos_2.*_neutral_~_8wekyb3d8bbwe.appxbundle")
{
Write-Information -MessageData "" -InformationAction Continue
# Write-Verbose -Message $Localization.MicrosoftToDoDownloading -Verbose
# Add to the Sophia.psd1 file a new string "MicrosoftToDoDownloading = Microsoft To Do: Lists, Tasks & Reminders... ~82 MB"
Write-Verbose -Message "Microsoft To Do: Lists, Tasks & Reminders... ~82 MB" -Verbose
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\$Package"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
# Installing "Microsoft To Do: Lists, Tasks & Reminders"
Add-AppxPackage -Path "$DownloadsFolder\$Package" -Verbose
Remove-Item -Path "$DownloadsFolder\$Package" -Force
}
}
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://store.rg-adguard.net")
Write-Error -Message ($Localization.NoResponse -f "https://store.rg-adguard.net") -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
}
"Manually"
{
if ((-not (Get-AppxPackage -Name Microsoft.HEVCVideoExtension)) -and (Get-AppxPackage -Name Microsoft.Windows.Photos))
{
try
{
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
Start-Process -FilePath ms-windows-store://pdp/?ProductId=9NBLGGH5R558
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Is it possible to add an option for installing apps from Microsoft Store by feeding with Store app urls?
There is already exist an installation process HEVC video extension by "https://store.rg-adguard.net/".
If we can feed it with "https://www.microsoft.com/store/productId/9NBLGGH5R558" like url, it would be awesome!
Thanks
Beta Was this translation helpful? Give feedback.
All reactions