Skip to content

Instantly share code, notes, and snippets.

@AspDotNetCP
Forked from crutkas/InstallWinGet.ps1
Created December 7, 2021 12:17
Show Gist options
  • Select an option

  • Save AspDotNetCP/96fa9ea6cd4e96e676fdb9b3e7c8771c to your computer and use it in GitHub Desktop.

Select an option

Save AspDotNetCP/96fa9ea6cd4e96e676fdb9b3e7c8771c to your computer and use it in GitHub Desktop.

Revisions

  1. @crutkas crutkas revised this gist Jun 28, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion InstallWinGet.ps1
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ function InstallWinGet()

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    $releases = Invoke-RestMethod -uri "$($releases_url)"
    $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith("appxbundle") } | Select -First 1
    $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith("msixbundle") } | Select -First 1

    Add-AppxPackage -Path $latestRelease.browser_download_url
    }
  2. @crutkas crutkas revised this gist Mar 31, 2021. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions InstallWinGet.ps1
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,14 @@ function InstallWinGet()
    }
    }

    <#
    Add-AppxPackage -Path "https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx"
    $releases_url = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    $releases = Invoke-RestMethod -uri "$($releases_url)"
    $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith("appxbundle") } | Select -First 1
    Add-AppxPackage -Path $latestRelease.browser_download_url
    #>
  3. @crutkas crutkas revised this gist Mar 16, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion InstallWinGet.ps1
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ function InstallWinGet()
    $releases_url = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    $releases = Invoke-RestMethod -uri "$($releases_url)?access_token=$($token)"
    $releases = Invoke-RestMethod -uri "$($releases_url)"
    $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith("appxbundle") } | Select -First 1

    Add-AppxPackage -Path $latestRelease.browser_download_url
  4. @crutkas crutkas created this gist Mar 16, 2021.
    17 changes: 17 additions & 0 deletions InstallWinGet.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    function InstallWinGet()
    {
    $hasPackageManager = Get-AppPackage -name "Microsoft.DesktopAppInstaller"

    if(!$hasPackageManager)
    {
    $releases_url = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    $releases = Invoke-RestMethod -uri "$($releases_url)?access_token=$($token)"
    $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith("appxbundle") } | Select -First 1

    Add-AppxPackage -Path $latestRelease.browser_download_url
    }
    }