2021-06-22 07:54:45 +00:00
|
|
|
[CmdletBinding()]
|
|
|
|
Param(
|
|
|
|
# None
|
|
|
|
)
|
|
|
|
|
2021-06-23 19:55:07 +00:00
|
|
|
# Download dependencies
|
|
|
|
$AppxDependencies = @(
|
|
|
|
@{
|
|
|
|
ShortName = 'vclibs'
|
|
|
|
QualifiedName = 'Microsoft.VCLibs.140.00_8wekyb3d8bbwe'
|
|
|
|
},
|
|
|
|
@{
|
|
|
|
ShortName = 'vclibsuwp'
|
|
|
|
QualifiedName = 'Microsoft.VCLibs.140.00.UWPDesktop_8wekyb3d8bbwe'
|
|
|
|
}
|
|
|
|
)
|
|
|
|
ForEach ($Dependency in $AppxDependencies) {
|
|
|
|
$InvokeWebRequestSplat = @{
|
|
|
|
Uri = 'https://store.rg-adguard.net/api/GetFiles'
|
|
|
|
Method = 'POST'
|
|
|
|
ContentType = 'application/x-www-form-urlencoded'
|
|
|
|
Body = "type=PackageFamilyName&url=$($Dependency.QualifiedName)&ring=RP&lang=en-US"
|
|
|
|
UseBasicParsing = $True
|
|
|
|
}
|
|
|
|
$InvokeWebRequestSplat = @{
|
|
|
|
Uri = ((Invoke-WebRequest @InvokeWebRequestSplat).Links | Where-Object {$_.OuterHTML -match '.appx' -and $_.outerHTML -match 'x64'}).href
|
|
|
|
OutFile = "$env:temp/$($Dependency.ShortName).appx"
|
|
|
|
}
|
|
|
|
Invoke-WebRequest @InvokeWebRequestSplat
|
|
|
|
}
|
|
|
|
# Download latest release from github
|
2021-06-22 07:54:45 +00:00
|
|
|
$InvokeRestMethodSplat = @{
|
|
|
|
Uri = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
|
|
|
|
Method = 'GET'
|
|
|
|
}
|
|
|
|
$InvokeWebRequestSplat = @{
|
2021-06-23 19:55:07 +00:00
|
|
|
Uri = ((Invoke-RestMethod @InvokeRestMethodSplat).assets | Where-Object {$_.name -like '*.appxbundle'}).browser_download_url
|
|
|
|
OutFile = "$env:temp\winget.appxbundle"
|
2021-06-22 07:54:45 +00:00
|
|
|
}
|
|
|
|
Invoke-WebRequest @InvokeWebRequestSplat
|
|
|
|
|
2021-06-23 19:55:07 +00:00
|
|
|
# Install dependencies
|
|
|
|
$AppxDependencies.ShortName | ForEach-Object {
|
|
|
|
$AddAppxPackageSplat = @{
|
|
|
|
Path = "$env:temp/$($_).appx"
|
|
|
|
}
|
|
|
|
Add-AppxPackage @AddAppxPackageSplat
|
2021-06-22 11:44:06 +00:00
|
|
|
}
|
2021-06-23 19:55:07 +00:00
|
|
|
# Install winget
|
|
|
|
$AddAppxPackageSplat = @{
|
|
|
|
Path = "$env:temp\winget.appxbundle"
|
|
|
|
}
|
|
|
|
Add-AppxPackage @AddAppxPackageSplat
|
2021-06-22 11:44:06 +00:00
|
|
|
|