Download-Files-TubesMedia-SearchAndDownloadFilesOnWebsite.psm1
<#
.EXTERNALHELP Download-Files-TubesMedia-SearchAndDownloadFilesOnWebsite.psm1-Help.xml #> function Invoke-FileDownload { param ( [Parameter(Mandatory = $true, Position = 1, HelpMessage = 'Provide correct URL like www.google.com')] [uri]$URL, [Parameter(Mandatory = $true, Position = 2, HelpMessage = 'Enter filename to search on website, you can use wilcards like: file*name*.jpg')] [SupportsWildcards()] [string]$Filename, [Parameter(HelpMessage = 'Enter full download path to folder.')] [string]$Path, [switch]$GetLink, [switch]$ListFoundedFiles, [Parameter(HelpMessage = 'Enter full alternate filename with exstension.')] [string]$NewFileName ) function Test-Admin { [CmdletBinding()] [OutputType([Boolean])] Param () $User = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() if ($User.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { return $true } return $false } function Get-UrlStatusCode { param ( [Parameter(Mandatory = $true)] [uri]$TestURL ) try { (Microsoft.PowerShell.Utility\Invoke-WebRequest -Uri $TestURL -UseBasicParsing -DisableKeepAlive -ErrorAction SilentlyContinue).StatusCode } catch [Net.WebException] { [int]$_.Exception.Response.StatusCode } } $IEcheck = (Microsoft.PowerShell.Management\Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main' -Name DisableFirstRunCustomize -ErrorAction SilentlyContinue).DisableFirstRunCustomize if ($IEcheck -ne 2) { if (Test-Admin) { Microsoft.PowerShell.Management\Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main" -Name "DisableFirstRunCustomize" -Value 2 } else { return Microsoft.PowerShell.Utility\Write-Warning 'Internet Explorer was not run for first time, to fix this run Internet explorer or run this command again in elevated console.' } } if (($Filename -eq "*") -or ($Filename -eq "*.*")) { return Microsoft.PowerShell.Utility\Write-Warning 'Cannot provide only wildcard.' } if (($GetLink) -and ([System.Management.Automation.WildcardPattern]::ContainsWildcardCharacters($Filename))) { return Microsoft.PowerShell.Utility\Write-Warning '-GetLink switch must be used with exact filename without wildcards.' } if ($Filename.Substring(0, 1) -ne "*") { $Filename = "*" + $Filename } if (!$Path) { $Path = Microsoft.PowerShell.Management\Get-Location } $DownloadWebPage = (Microsoft.PowerShell.Utility\Invoke-WebRequest "$URL").AllElements $FilesFinded = $DownloadWebPage.href -like "$Filename" if (!$FilesFinded) { return Microsoft.PowerShell.Utility\Write-Warning "No files found like $Filename" } $FileSelection = Microsoft.PowerShell.Management\Split-Path -Path $FilesFinded -Leaf if ($FilesFinded.Count -gt 1) { $WEBPath = $FilesFinded.Split([Environment]::NewLine) | Microsoft.PowerShell.Utility\Select-Object -First 1 } else { $WEBPath = $FilesFinded } $statusCode = Get-UrlStatusCode -TestURL "$WEBPath" -ErrorAction SilentlyContinue if (($statusCode -eq 0) -or (!$statusCode)) { $WEBPath = "$URL" + $WEBPath $statusCode = Get-UrlStatusCode -TestURL "$WEBPath" if (($statusCode -eq 0) -or (!$statusCode)) { return Microsoft.PowerShell.Utility\Write-Error "Cannot find download link for searched file on the $URL" -Category InvalidResult } } if ($NewFileName) { $Filename = $NewFileName } else { $Filename = Microsoft.PowerShell.Management\Split-Path $WEBPath -Leaf } $FullFilePath = Microsoft.PowerShell.Management\Join-Path -Path $Path -ChildPath $Filename if ($GetLink -and $ListFoundedFiles) { Microsoft.PowerShell.Utility\Write-Warning "-GetLink switch should be used without -ListFoundedFiles switch." } if ($GetLink -and (!$ListFoundedFiles)) { $CleanPath = Microsoft.PowerShell.Utility\Invoke-WebRequest -Uri $WEBPath -MaximumRedirection 0 -ErrorAction SilentlyContinue $WEBPath = $CleanPath.Headers.Values | Microsoft.PowerShell.Utility\Select-String -SimpleMatch $Filename return $WEBPath } elseif ($ListFoundedFiles) { if ($FileSelection.Count -eq 1) { Microsoft.PowerShell.Utility\Write-Output "Only one file founded:" } return $FileSelection } else { Microsoft.PowerShell.Utility\Invoke-WebRequest -Uri $WEBPath -OutFile $FullFilePath -Method Get return Microsoft.PowerShell.Utility\Write-Output "Download path: $FullFilePath" } } <# .EXTERNALHELP Download-Files-TubesMedia-SearchAndDownloadFilesOnWebsite.psm1-Help.xml #> function Invoke-MediaDownload { [CmdletBinding()] param ( [Parameter(Mandatory = $false, Position = 1, HelpMessage = 'Put pure link from site that you want to download it.')] [uri]$URL, [Parameter(Position = 4, HelpMessage = 'Use only if first method fails.')] [switch]$ytdlMethod, [Parameter(Position = 2)] [string]$Path = ($env:SystemDrive + $env:HOMEPATH + '\Videos\'), [Parameter(Position = 3)] [string]$AdditionalArguments, [Parameter(Position = 5)] [switch]$Help ) $WinGetEXE = 'winget.exe' $choco = 'choco.exe' $Downloader = 'yt-dlp.exe' $Downloader2 = 'youtube-dl.exe' function Test-Admin { [CmdletBinding()] [OutputType([Boolean])] Param () $User = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() if ($User.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { return $true } return $false } #region InstallNeeded function Get-NuGet { Microsoft.PowerShell.Utility\Write-Output "Getting NuGet package manager, answer 'Yes' if asked." $Repository = 'PSGallery' if (PowerShellGet\Get-PSRepository | Microsoft.PowerShell.Core\Where-Object { $_.Name -eq $Repository -and $_.InstallationPolicy -ne "Trusted" }) { try { PackageManagement\Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.208 -Force -ErrorAction SilentlyContinue PowerShellGet\Set-PSRepository -Name $Repository -InstallationPolicy Trusted -ErrorAction SilentlyContinue } catch { throw $_ } } if (!(PackageManagement\Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 PowerShellGet\Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted -ErrorAction SilentlyContinue PackageManagement\Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -ErrorAction SilentlyContinue if (!(PackageManagement\Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) { return Microsoft.PowerShell.Utility\Write-Error -Message 'Cannot get NuGet package manager. Please update PowerShell.' -Category NotInstalled } } } function Install-WinGet { $Xaml = Appx\Get-AppxPackage -Name 'Microsoft.UI.Xaml.2.7*' -ErrorAction SilentlyContinue if (!($Xaml)) { Microsoft.PowerShell.Utility\Write-Output 'Installing Microsoft.UI.Xaml.2.7.1' $url = 'https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.1' $zipFile = $env:TEMP + '\XamlTemp.zip' $tempFolder = Microsoft.PowerShell.Management\New-Item -Path "$env:TEMP\XamlInst\" -ItemType Directory -Force -ErrorAction SilentlyContinue Microsoft.PowerShell.Utility\Invoke-WebRequest -Uri $url -OutFile $zipFile Microsoft.PowerShell.Archive\Expand-Archive -Path $zipFile -DestinationPath $env:TEMP\XamlInst\ -Force -ErrorAction SilentlyContinue if ([Environment]::Is64BitOperatingSystem) { Appx\Add-AppxPackage -Path $tempFolder\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx -ForceApplicationShutdown -Update -ErrorAction SilentlyContinue Microsoft.PowerShell.Management\Remove-Item -Path $zipFile -Force -ErrorAction SilentlyContinue Microsoft.PowerShell.Management\Remove-Item -Path $tempFolder -Force -ErrorAction SilentlyContinue } else { Appx\Add-AppxPackage -Path $tempFolder\tools\AppX\x86\Release\Microsoft.UI.Xaml.2.7.appx -ForceApplicationShutdown -Update -ErrorAction SilentlyContinue Microsoft.PowerShell.Management\Remove-Item -Path $zipFile -Force -ErrorAction SilentlyContinue Microsoft.PowerShell.Management\Remove-Item -Path $tempFolder -Force -ErrorAction SilentlyContinue } if (!($Xaml)) { return Microsoft.PowerShell.Utility\Write-Warning 'Microsoft.UI.Xaml.2.7.1 not installed. Please update Windows.' } } $hasPackageManager = Appx\Get-AppxPackage -name 'Microsoft.DesktopAppInstaller' -ErrorAction SilentlyContinue if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") { Microsoft.PowerShell.Utility\Write-Output 'Installing WinGet application manager.' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 if (!$hasPackageManager) { Appx\Add-AppxPackage -Path https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -InstallAllResources -ForceApplicationShutdown } else { Appx\Add-AppxPackage -Path https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -ForceUpdateFromAnyVersion -ForceApplicationShutdown } $releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $releases = Microsoft.PowerShell.Utility\Invoke-RestMethod -uri $releases_url $latestRelease = $releases.assets | Microsoft.PowerShell.Core\Where-Object { $_.browser_download_url.EndsWith('msixbundle') } | Microsoft.PowerShell.Utility\Select-Object -First 1 Microsoft.PowerShell.Utility\Write-Output "Installing winget from $($latestRelease.browser_download_url)" Appx\Add-AppxPackage -Path $latestRelease.browser_download_url } if (!(Microsoft.PowerShell.Core\Get-Command -Name 'winget.exe' -ErrorAction SilentlyContinue) -and ($restart)) { Microsoft.PowerShell.Utility\Write-Warning '-restart switch is used, computer will restart in 5 secounds...' Microsoft.PowerShell.Management\Restart-Computer -Force -Timeout 5 } if (!(Microsoft.PowerShell.Core\Get-Command -CommandType Application -Name winget.exe -ErrorAction SilentlyContinue)) { return Microsoft.PowerShell.Utility\Write-Warning "WinGet still not active, please try to restart the computer and run this command again.`nIf you have fresh installed Windows please update it first." } } function Get-InstalledSoftware { [CmdletBinding(SupportsShouldProcess = $false)] [OutputType([System.Management.Automation.PSObject])] param ( [Parameter()] [ValidateNotNullOrEmpty()] [System.String]$Name ) process { $UninstallKeys = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" $null = Microsoft.PowerShell.Management\New-PSDrive -Name "HKU" -PSProvider "Registry" -Root "Registry::HKEY_USERS" $UninstallKeys += Microsoft.PowerShell.Management\Get-ChildItem -Path "HKU:" -ErrorAction "SilentlyContinue" | ` Microsoft.PowerShell.Core\Where-Object { $_.Name -match "S-\d-\d+-(\d+-){1,14}\d+$" } | ` Microsoft.PowerShell.Core\ForEach-Object { "HKU:\$($_.PSChildName)\Software\Microsoft\Windows\CurrentVersion\Uninstall" } foreach ($UninstallKey in $UninstallKeys) { if ($PSBoundParameters.ContainsKey("Name")) { $WhereBlock = { ($_.PSChildName -match "^{[A-Z0-9]{8}-([A-Z0-9]{4}-){3}[A-Z0-9]{12}}$") -and ($_.GetValue("DisplayName") -like "$Name*") } } else { $WhereBlock = { ($_.PSChildName -match "^{[A-Z0-9]{8}-([A-Z0-9]{4}-){3}[A-Z0-9]{12}}$") -and ($_.GetValue("DisplayName")) } } $SelectProperties = @( @{ n = "Publisher"; e = { $_.GetValue("Publisher") } }, @{ n = "Name"; e = { $_.GetValue("DisplayName") } }, @{ n = "Version"; e = { $_.GetValue("DisplayVersion") } }, @{ n = "ProductCode"; e = { $_.PSChildName } }, @{ n = "BundleCachePath"; e = { $_.GetValue("BundleCachePath") } }, @{ n = "Architecture"; e = { if ($_.GetValue("DisplayName") -like "*x64*") { "x64" } else { "x86" } } }, @{ n = "Release"; e = { if ($_.GetValue("DisplayName") -match [RegEx]"(\d{4})\s+") { $matches[0].Trim(" ") } } }, @{ n = "UninstallString"; e = { $_.GetValue("UninstallString") } }, @{ n = "QuietUninstallString"; e = { $_.GetValue("QuietUninstallString") } }, @{ n = "UninstallKey"; e = { $UninstallKey } } ) $params = @{ Path = $UninstallKey ErrorAction = "SilentlyContinue" } Microsoft.PowerShell.Management\Get-ChildItem @params | Microsoft.PowerShell.Core\Where-Object $WhereBlock | Microsoft.PowerShell.Utility\Select-Object -Property $SelectProperties } } end { Microsoft.PowerShell.Management\Remove-PSDrive -Name "HKU" -ErrorAction "SilentlyContinue" } } function Get-InstalledVcRedist { [CmdletBinding(SupportsShouldProcess = $false, HelpURI = "https://vcredist.com/get-installedvcredist/")] [OutputType([System.Management.Automation.PSObject])] param ( [Parameter(Mandatory = $false)] [System.Management.Automation.SwitchParameter]$ExportAll ) if ($PSBoundParameters.ContainsKey("ExportAll")) { Microsoft.PowerShell.Utility\Write-Verbose -Message "-ExportAll specified. Exporting all install Visual C++ Redistributables and runtimes." $Filter = "(Microsoft Visual C.*).*" } else { $Filter = "(Microsoft Visual C.*)(\bRedistributable).*" } Microsoft.PowerShell.Utility\Write-Verbose -Message "Matching installed VcRedists with: '$Filter'." $VcRedists = Get-InstalledSoftware | Microsoft.PowerShell.Core\Where-Object { $_.Name -match $Filter } Microsoft.PowerShell.Utility\Write-Verbose -Message "Add Architecture property to output object." $VcRedists | Microsoft.PowerShell.Core\ForEach-Object { if ($_.Name -contains "x64") { $_ | Microsoft.PowerShell.Utility\Add-Member -NotePropertyName "Architecture" -NotePropertyValue "x64" } } Microsoft.PowerShell.Utility\Write-Output -InputObject $VcRedists } function Test-VcRedist { $vcr = (Get-InstalledVcRedist).Name -like "*2010*x86*" if (!([boolean]$vcr)) { Microsoft.PowerShell.Utility\Write-Output 'Installing Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package (x86)' $VcSetup = "$env:TEMP\vcredist_x86.exe" if (Microsoft.PowerShell.Management\Test-Path $VcSetup -ErrorAction SilentlyContinue) { Microsoft.PowerShell.Management\Remove-Item $VcSetup -Force -Recurse -ErrorAction SilentlyContinue } $VcURL = "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe" Microsoft.PowerShell.Utility\Invoke-WebRequest -Uri $VcURL -OutFile $VcSetup -Method Get -ErrorAction SilentlyContinue Microsoft.PowerShell.Management\Start-Process -FilePath $VcSetup -ArgumentList "/passive /norestart" -Wait -ErrorAction SilentlyContinue Microsoft.PowerShell.Management\Remove-Item $VcSetup -Force -ErrorAction SilentlyContinue $vcr = (Get-InstalledVcRedist).Name -like "*2010*x86*" if (!([boolean]$vcr)) { return Microsoft.PowerShell.Utility\Write-Warning "Installing Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package (x86) failed.`nPlease update Windows and restart it and run this command again" } } } function Test-AllNeeded { Test-VcRedist if (!(Microsoft.PowerShell.Core\Get-Command -CommandType Application -Name winget.exe -ErrorAction SilentlyContinue)) { $checkNuGeT = PackageManagement\Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyContinue if (!$checkNuGeT) { Get-NuGet } else { PackageManagement\Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.208 } Install-WinGet if (!(Microsoft.PowerShell.Core\Get-Command -CommandType Application -Name winget.exe -ErrorAction SilentlyContinue)) { Microsoft.PowerShell.Utility\Write-Error 'WinGet not installed, if your Windows is fresh installed, please update it and restart the computer.' -Category NotInstalled } } if (!(Microsoft.PowerShell.Core\Get-Command -Name $Downloader -ErrorAction SilentlyContinue)) { Microsoft.PowerShell.Utility\Write-Output 'Getting yt-dlp video/audio download manager.' Microsoft.PowerShell.Management\Start-Process -FilePath $WinGetEXE -ArgumentList "install yt-dlp --accept-package-agreements" -NoNewWindow -Wait if (!(Microsoft.PowerShell.Core\Get-Command -Name $Downloader -ErrorAction SilentlyContinue)) { return Microsoft.PowerShell.Utility\Write-Warning 'yt-dlp.exe not installed, restart the computer and start this command again' } else { Microsoft.PowerShell.Management\Start-Process -FilePath $Downloader -ArgumentList '-U' -NoNewWindow -Wait } } if (!(Microsoft.PowerShell.Core\Get-Command -Name $Downloader2 -ErrorAction SilentlyContinue)) { Microsoft.PowerShell.Utility\Write-Output 'Getting youtube-dl video/audio download manager.' Microsoft.PowerShell.Management\Start-Process -FilePath $choco -ArgumentList "install youtube-dl -y -f" -NoNewWindow -Wait } if (!(Microsoft.PowerShell.Core\Get-Command -Name $Downloader2 -ErrorAction SilentlyContinue)) { $here = (Microsoft.PowerShell.Management\Get-Location).Path Invoke-FileDownload -URL https://yt-dl.org/ -Filename $Downloader2 -Path $here Microsoft.PowerShell.Management\Start-Process -FilePath $Downloader2 -ArgumentList '-U' -NoNewWindow -Wait if (!(Microsoft.PowerShell.Core\Get-Command -Name $Downloader2 -ErrorAction SilentlyContinue)) { return Microsoft.PowerShell.Utility\Write-Warning "youtube-dl.exe not installed.`nTry to restart or update Windows then run this command again." } } else { Microsoft.PowerShell.Management\Start-Process -FilePath $Downloader -ArgumentList '-U' -NoNewWindow -Wait } } #endregion InstallNeeded #region check if (!(Test-Admin) -and (!(Microsoft.PowerShell.Core\Get-Command -Name $Downloader -ErrorAction SilentlyContinue) -or !(Microsoft.PowerShell.Core\Get-Command -Name $Downloader2 -ErrorAction SilentlyContinue))) { return Microsoft.PowerShell.Utility\Write-Warning 'To install necessary software for this module run this command at elevated console for first time.' } else { if (!(Microsoft.PowerShell.Core\Get-Command -Name $choco -ErrorAction SilentlyContinue)) { Microsoft.PowerShell.Security\Set-ExecutionPolicy Bypass -Scope Process -Force [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 Microsoft.PowerShell.Utility\Invoke-Expression ((Microsoft.PowerShell.Utility\New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) if (!(Microsoft.PowerShell.Core\Get-Command -Name $choco -ErrorAction SilentlyContinue)) { Microsoft.PowerShell.Utility\Write-Warning "The Package Manager for Windows chocolatey failed to install.`nTrying with alternative." Test-AllNeeded if (!(Microsoft.PowerShell.Core\Get-Command -Name $Downloader -ErrorAction SilentlyContinue) -or !(Microsoft.PowerShell.Core\Get-Command -Name $Downloader2 -ErrorAction SilentlyContinue)) { return Microsoft.PowerShell.Utility\Write-Error 'Cannot install needed files. Try to update Windows.' -Category NotInstalled } else { return Microsoft.PowerShell.Utility\Write-Output 'Installed in alternate way. Please run the command again.' } } else { Microsoft.PowerShell.Management\Start-Process -FilePath $choco -ArgumentList "install yt-dlp -y -f --nocolor --no-progress" -NoNewWindow -Wait Microsoft.PowerShell.Management\Start-Process -FilePath $choco -ArgumentList "install youtube-dl -y -f --nocolor --no-progress" -NoNewWindow -Wait if (!(Microsoft.PowerShell.Core\Get-Command -Name $Downloader -ErrorAction SilentlyContinue) -or !(Microsoft.PowerShell.Core\Get-Command -Name $Downloader2 -ErrorAction SilentlyContinue)) { if (!(Microsoft.PowerShell.Core\Get-Command -Name $Downloader -ErrorAction SilentlyContinue) -or !(Microsoft.PowerShell.Core\Get-Command -Name $Downloader2 -ErrorAction SilentlyContinue)) { return Microsoft.PowerShell.Utility\Write-Error 'Cannot install needed files. Try to update Windows.' -Category NotInstalled } } } } } #endregion check if (!$URL -and !$Help) { return Microsoft.PowerShell.Utility\Write-Error 'Must specify the URL for video download.' -Category OperationStopped } if ($Help) { if ($ytdlMethod) { Microsoft.PowerShell.Utility\Write-Output '' Microsoft.PowerShell.Management\Start-Process -FilePath $Downloader2 -ArgumentList "--help" -NoNewWindow -Wait Microsoft.PowerShell.Utility\Write-Output '' } else { Microsoft.PowerShell.Utility\Write-Output '' Microsoft.PowerShell.Management\Start-Process -FilePath $Downloader -ArgumentList "--help" -NoNewWindow -Wait Microsoft.PowerShell.Utility\Write-Output '' } return Microsoft.PowerShell.Utility\Write-Warning 'If you get an error when try to download media (livestream or something unusual) use -AdditionalArguments and put the switch from this help like -AdditionalArguments "--SomeSwitch".' } if ($ytdlMethod) { $Filename = Microsoft.PowerShell.Utility\Read-Host -Prompt "File will be dowloaded at $Path`nPlease enter the filename for video file" if ($Filename -like '') { return Microsoft.PowerShell.Utility\Write-Error "With youtube-dl method filename must be entered." -Category InvalidData } $arguments = "$URL -o $Path$Filename.mp4 " if ($AdditionalArguments) { $arguments = $arguments + $AdditionalArguments } Microsoft.PowerShell.Utility\Write-Output '' Microsoft.PowerShell.Management\Start-Process -FilePath $Downloader2 -ArgumentList $arguments -NoNewWindow -Wait Microsoft.PowerShell.Management\Start-Process -FilePath $Downloader2 -ArgumentList '-U' -WindowStyle Hidden Microsoft.PowerShell.Utility\Write-Output '' } else { $arguments = "$URL -P$Path " if ($AdditionalArguments) { $arguments = $arguments + $AdditionalArguments } Microsoft.PowerShell.Utility\Write-Output '' Microsoft.PowerShell.Management\Start-Process -FilePath $Downloader -ArgumentList $arguments -NoNewWindow -Wait Microsoft.PowerShell.Management\Start-Process -FilePath $Downloader -ArgumentList '-U' -WindowStyle Hidden Microsoft.PowerShell.Utility\Write-Output '' } } |