Scripts/install-7zip.ps1

<#
.SYNOPSIS
  Wrapper script for installing 7-zip
 
.DESCRIPTION
  Provides functionality for downloading and installing packages, including logging and exit codes.
 
.PARAMETER User
  Mandatory : Generic or customer specific login on dist server. Use quotation marks!
.PARAMETER Pass
  Mandatory : Password for dist server (mandatory). Use quotation marks!
 
.EXAMPLE
  > Powershell.exe -ExecutionPolicy ByPass -File .\install-SomeApplication.ps1 -User "CUST-Kakbolaget" -Pass "sup3rs3cr3tp@ssw0rd"
 
.NOTES
  Version: 2.2
  Author: Mikael Karlsson
 
  Version history
  1.0 2023-10-09 - Initial release
 
.LINK
  Documentation: https://nordlosthc.eu.itglue.com/1649140723777754/documents/folder/3389170169659635/
  Wrapper scripts: https://nordlo.sharepoint.com/:f:/r/sites/city/Leverans/Internt/St%C3%B6dsystem/Dist/Install%20Wrappers?csf=1&web=1&e=OmV9eo
#>


[CmdletBinding()]
Param(
  [Parameter(Mandatory=$false)] [String]$User,
  [Parameter(Mandatory=$false)] [string]$Pass,
  [Parameter(Mandatory=$false)][ValidateSet("Leave","Remove")][string]$PublicDesktopShortcuts="Leave"
)

$FunctionsLibrary = "DeployLibNorEvo"
$Global:User = $User
$Global:Pass = $Pass
$Global:PublicDesktopShortcuts = $PublicDesktopShortcuts
$Global:ScriptName = Split-Path -Leaf $MyInvocation.MyCommand.Path
$null = Install-PackageProvider -Name "NuGet" -Force
Remove-Module $FunctionsLibrary -Force -ErrorAction SilentlyContinue
Install-Module -Name $FunctionsLibrary -Force
Start-NEDeploySession

### Custom Code Starts ####################################################################################################################

### Install 7-Zip
$AppDeploy_Name = "7-zip"
$AppDeploy_Folder = "https://dist.city.nordlo.cloud/dist/applications/7-Zip/latest"
$AppDeploy_Package = "7zip-x64-latest.msi"
$AppDeploy_Arguments = "/i `"$Global:WorkingFolder\$AppDeploy_Package`" /qn /norestart /L `"$Global:Logpath\$AppDeploy_Name-install.log`""

# Download
Invoke-NEFileTransfer -URL "$AppDeploy_Folder/$AppDeploy_Package"

# Install
Write-NELog "Initiating installation of $AppDeploy_Name"
$p = Start-Process -FilePath "msiexec.exe" -Wait -PassThru -ArgumentList $AppDeploy_Arguments
Invoke-NEInstallResult -ExitCode $p.ExitCode

### Custom Code Ends ####################################################################################################################
Invoke-NEFinalAction