get software installer via Powershell                                                                                                                                            last update 26.08.2023

IE must be run once to complete the installation before downloading the installer !

copy and paste three lines (one block) to powershell to avoid an error
in terms off insecure channel in powershell.


# get latest Firefox via Powershell
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=de' -OutFile $env:USERPROFILE\Downloads\Firefox_latest_setup.exe

# get
latest Firefox ESR via Powershell
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://download.mozilla.org/?product=firefox-esr-latest&os=win64&lang=de' -OutFile $env:USERPROFILE\Downloads\Firefox_esr_latest_setup.exe

# get latest Thunderbird via Powershell
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://download.mozilla.org/?product=thunderbird-latest&os=win64&lang=de' -OutFile $env:USERPROFILE\Downloads\thunderbird_esr_latest_setup.exe

# get latest Filezilla
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://download.filezilla-project.org/client/FileZilla_3.65.0_win64_sponsored-setup.exe' $env:USERPROFILE\Downloads\FileZilla_3.65.0_win64_sponsored-setup.exe

# get latest 7zip via Powershell
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest -Uri https://7-zip.org/a/7z2408-x64.exe -OutFile $env:USERPROFILE\Downloads\7z2408-x64.exe

$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://sourceforge.net/projects/sevenzip/files/7-Zip/23.01/7z2301-x64.exe/download -OutFile $env:USERPROFILE\Downloads\7z2301-x64.exe

# or from Powershell Gallery
Install-Module -Name 7Zip4Powershell

# get Micrsoft Edge via Powershell
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://go.microsoft.com/fwlink/?linkid=2108834&Channel=Stable&language=de'  -OutFile $env:USERPROFILE\Downloads\MicrosoftEdgeSetup.exe

# get Google Chrome via Powershell
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
 Invoke-WebRequest 'https://dl.google.com/chrome/install/latest/chrome_installer.exe'  -OutFile $env:USERPROFILE\Downloads\chrome_installer.exe

# get latest Notepad++ via Powershell
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.5.6/npp.8.5.6.Installer.x64.exe'  -OutFile $env:USERPROFILE\Downloads\npp.8.5.6.Installer.x64.exe

# get latest Microsofts sysinternals
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://download.sysinternals.com/files/SysinternalsSuite.zip'  -OutFile $env:USERPROFILE\Downloads\SysinternalsSuite.zip

# get latest Greenshot
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://github.com/greenshot/greenshot/releases/download/Greenshot-RELEASE-1.2.10.6/Greenshot-INSTALLER-1.2.10.6-RELEASE.exe' -OutFile $env:USERPROFILE\Downloads\Greenshot-INSTALLER-1.2.10.6-RELEASE.exe

####################################################################
# get latest Adobe Reader script
####################################################################
Set-Location $env:USERPROFILE\Downloads
$ftp = "ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/"
Write-Host "Downloading Adobe Acrobat Reader DC Deutsch"
# We have to use .NET to read a directory listing from FTP, it is different than downloading a file.
# Original C# code at https://docs.microsoft.com/en-us/dotnet ... s-with-ftp

$request = [System.Net.FtpWebRequest]::Create($ftp);
$request.Credentials = [System.Net.NetworkCredential]::new("anonymous", "password");
$request.Method = [System.Net.WebRequestMethods+Ftp]::ListDirectoryDetails;
[System.Net.FtpWebResponse]$response = [System.Net.FtpWebResponse]$request.GetResponse();
[System.IO.Stream]$responseStream = $response.GetResponseStream();
[System.IO.StreamReader]$reader = [System.IO.StreamReader]::new($responseStream);
$DirList = $reader.ReadToEnd()
$reader.Close()
$response.close()

# Split into Lines, currently it is one big string.
$DirByLine = $DirList.split("`n")

# Get the token containing the folder name.
$folders = @()
foreach ($line in $DirByLine ) {
$endtoken = ($line.split(' '))[-1]
#filter out non version folder names
if ($endtoken -match "[0-9]") {
$folders += $endtoken
}
}

# Sort the folders by newest first, and select the first 1, and remove the newline whitespace at the end.
$currentfolder = ($folders | sort -Descending | select -First 1).trim()

# PowerShell Wrapper for MDT, Standalone and Chocolatey Installation - (C)2015 xenappblog.com
# Example 1: Start-Process "XenDesktopServerSetup.exe" -ArgumentList $unattendedArgs -Wait -Passthru
# Example 2 Powershell: Start-Process powershell.exe -ExecutionPolicy bypass -file $Destination
# Example 3 EXE (Always use ' '):
# $UnattendedArgs='/qn'
# (Start-Process "$PackageName.$InstallerType" $UnattendedArgs -Wait -Passthru).ExitCode
# Example 4 MSI (Always use " "):
# $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 /qn /liewa $LogApp"
# (Start-Process msiexec.exe -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode

Clear-Host
Write-Verbose "Setting Arguments" -Verbose
$StartDTM = (Get-Date)

$Vendor = "Adobe"
$Product = "Reader DC"
$PackageName = "AcroRdrDC"
$Version = "$currentfolder"
$InstallerType = "exe"
$Source = "$PackageName" + "." + "$InstallerType"
$LogPS = "${env:SystemRoot}" + "\Temp\$Vendor $Product $Version PS Wrapper.log"
$LogApp = "${env:SystemRoot}" + "\Temp\$PackageName.log"
$Destination = "${env:ChocoRepository}" + "\$Vendor\$Product\$Version\$packageName.$installerType"
$UnattendedArgs = '/sAll /msi /norestart /quiet ALLUSERS=1 EULA_ACCEPT=YES'
$ProgressPreference = 'Continue'
# wenn keine Anzeige des Fortschritts erfolgen soll > $ProgressPreference = 'SilentlyContinue'
Start-Transcript $LogPS | Out-Null

Write-Verbose "Checking Internet Connection" -Verbose

If (!(Test-Connection -ComputerName www.google.com -Count 1 -quiet)) {
Write-Verbose "Internet Connection is Down" -Verbose
}
Else {
Write-Verbose "Internet Connection is Up" -Verbose
}

Write-Verbose "Writing Version Number to File" -Verbose
if (!$Version) {
$Version = Get-Content -Path ".\Version.txt"
}
Else {
$Version | Out-File -FilePath ".\Version.txt" -Force
}

if( -Not (Test-Path -Path $Version ) )
{
New-Item -ItemType directory -Path $Version | Out-Null
$Version | Out-File -FilePath ".\Version.txt" -Force
}

# CD $Version

If (!(Test-Path -Path $Source)) {
Write-Verbose "Downloading $Vendor $Product $Version" -Verbose
$EXEDownload = "$($ftp)$($currentfolder)`/AcroRdrDC$($currentfolder)_de_DE.exe"
$filename = ($EXEDownload.split("/"))[-1]
wget -uri $EXEDownload -outfile $Source
}
Else {
Write-Verbose "File Exists. Skipping Download." -Verbose
}

####################################################################

# get latest stable LibreOffice via Powershell
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://de.libreoffice.org/donate/dl/win-x86_64/7.5.5/de/LibreOffice_7.5.5_Win_x86-64.msi' -OutFile  $env:USERPROFILE\Downloads\LibreOffice_7.5.5_Win_x86-64.msi

# get latest stable LibreOffice Help via Powershell
$AllProtocols = [System.Net.SecurityProtocolType]'Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
Invoke-WebRequest 'https://download.documentfoundation.org/libreoffice/stable/7.5.5/win/x86_64/LibreOffice_7.5.5_Win_x86-64_helppack_de.msi' -OutFile $env:USERPROFILE\Downloads\LibreOffice_7.5.5_Win_x86-64_helppack_de.msi


# get Visual C++ Redistributable
# Microsoft Visual C++ Redistributable latest supported downloads
# or with powershell
# Visual Studio 2015, 2017, 2019 und 2022
curl -L -o %USERPROFILE%\Downloads\vc_redist_2019-2022.x64.exe "https://aka.ms/vs/17/release/vc_redist.x64.exe" --ssl-no-revoke
Invoke-WebRequest 'https://aka.ms/vs/17/release/vc_redist.x64.exe' -OutFile $env:USERPROFILE\Downloads\vc_redist_2019-2022.x64.exe

# Visual Studio 2013 (VC++ 12.0)
curl -L -o %USERPROFILE%\Downloads\vc_redist_2013.x64.exe "https://aka.ms/highdpimfc2013x64enu" --ssl-no-revoke
Invoke-WebRequest 'https://aka.ms/highdpimfc2013x64enu' -OutFile $env:USERPROFILE\Downloads\vc_redist_2013.x64.exe

# Visual Studio 2010 (VC++ 10.0)
curl -L -o %USERPROFILE%\Downloads\vc_redist_2010.x64.exe "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe" --ssl-no-revoke
Invoke-WebRequest 'https://aka.ms/highdpimfc2013x64enu' -OutFile $env:USERPROFILE\Downloads\vc_redist_2010.x64.exe

# Visual Studio 2008 (VC++ 9.0) SP1
curl -L -o %USERPROFILE%\Downloads\vc_redist_2008.x64.exe "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe" --ssl-no-revoke
Invoke-WebRequest 'https://aka.ms/highdpimfc2013x64enu' -OutFile $env:USERPROFILE\Downloads\vc_redist_2008.x64.exe

# install all versions of Visual C++ Redistributable
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://vcredist.com/install.ps1'))
# or
Install-Module VcRedist
Import-Module VcRedist
$VcList = Get-VcList | Get-VcRedist -Path "C:\Temp\VcRedist"
$VcList | Install-VcRedist -Path C:\Temp\VcRedist

# to install the downloaded files ( .exe or .msi):
start-process <file> <options>

# If you want to use the command line:
curl -L -o <destination path/file> "<source path/file>"
curl -L -o %USERPROFILE%\Downloads\Firefox_esr_latest_setup.exe "https://download.mozilla.org/?product=firefox-esr-latest&os=win64&lang=de"