Skip to Main Content
Patch My PC Ideas & Feedback

A community where customers and the community can provide feedback to make a better product for everyone! For more details on how we prioritize requests, please see:

1 VOTE
Status SUBMITTED
Created by Guest
Created on Nov 18, 2024

Automatically download FSLogix via direct link

There is a direct link to downloading the latest version, https://aka.ms/fslogix_download. It would be a nice addition if the file could be automatically downloaded.

  • Attach files
  • Guest
    Mar 11, 2025

    I've created a script that we're using, to download the latest version and place the extracted files into the PMPC LocalRepository (but the formatting here looks awful...):


    <#

    .SYNOPSIS Downloads FSLogix from official download-link.

    .DESCRIPTION Downloads from FSLogix official download-link, unzips and copies to $DestinationPath.

    .PARAMETER Url Web address to download from. Using https://aka.ms/fslogix_download as default. The adress is listed on https://learn.microsoft.com/en-us/fslogix/how-to-install-fslogix#direct-download

    .PARAMETER DestinationPath Folder to copy the extracted files to.

    .PARAMETER LogFolder Folder for log files.

    #>


    param(

    [Parameter()] [string]$Url = "https://aka.ms/fslogix_download",
    [Parameter()] [string]$DestinationPath,
    [Parameter()] [string]$LogFolder = "C:\Data\Log"

    )


    $ErrorActionPreference = "Stop"
    $logFile = Join-Path -Path $LogFolder -ChildPath "Get-FSLogixLatestVersion.log"

    $dnFile = Join-Path -Path $env:TEMP -ChildPath "FSLogix.zip"

    # Download FSLogix

    Out-File -FilePath $logFile -InputObject "Downloading FSLogix from URL: $Url."

    $webClient = New-Object System.Net.WebClient

    $webClient.DownloadFile($Url, $dnFile)

    $webClient.Dispose()

    # Verify that stuff got downloaded

    if ((Test-Path -Path $dnFile) -eq $false) {

    Out-File -FilePath $logFile -InputObject "Failed to download FSLogix." -Append

    throw $_}

    else {

    try {

    Out-File -FilePath $logFile -InputObject "Download OK." -Append

    Out-File -FilePath $logFile -InputObject "Attempting to unpack." -Append

    Add-Type -AssemblyName System.IO.Compression.FileSystem

    $unpackPath = "$env:TEMP\FSLogix"

    [System.IO.Compression.ZipFile]::ExtractToDirectory($dnFile, $unpackPath)

    Out-File -FilePath $logFile -InputObject "Unpack OK." -Append

    }

    catch {

    Out-File -FilePath $logFile -InputObject "Failed to unpack FSLogix from archive." -Append

    Out-File -FilePath $logFile -InputObject "Error message: $_" -Append

    throw $_ }

    }

    # Copy FSLogix to PatchMyPc repository

    try {

    Out-File -FilePath $logFile -InputObject "Attempting to copy to $DestinationPath." -Append

    Copy-Item -Path $unpackPath -Destination $DestinationPath -Recurse -Force -Container

    Out-File -FilePath $logFile -InputObject "Copy OK." -Append

    }

    catch {

    Out-File -FilePath $logFile -InputObject "Failed to copy to $DestinationPath." -Append

    Out-File -FilePath $logFile -InputObject "Error message: $_" -Append

    throw $_

    }

    # Cleanup

    try {

    Remove-Item -Path $dnFile -Force -Confirm:$false

    Remove-Item -Path $unpackPath -Force -Recurse -Confirm:$false

    }

    catch {

    Out-File -FilePath $logFile -InputObject "Failed to cleanup." -Append

    Out-File -FilePath $logFile -InputObject "Error message: $_" -Append

    throw $_

    }

  • Claudio Mendes
    Nov 20, 2024

    +1