diff --git a/Scripts/Install-Modules.ps1 b/Scripts/Install-Modules.ps1 index 94a5278..331f055 100644 --- a/Scripts/Install-Modules.ps1 +++ b/Scripts/Install-Modules.ps1 @@ -23,7 +23,7 @@ Process { # Ensure package provider is installed $PackageProvider = Install-PackageProvider -Name "NuGet" -Force - $Modules = @("Evergreen", "IntuneWin32App", "Az.Storage", "Az.Resources", "MSGraphRequest") + $Modules = @("Evergreen", "IntuneWin32App", "Az.Storage", "Az.Resources") foreach ($Module in $Modules) { try { Write-Output -InputObject "Attempting to locate module: $($Module)" @@ -46,7 +46,7 @@ Process { } else { Write-Output -InputObject "Attempting to install module: $($Module)" - $InstallModuleInvocation = Install-Module -Name $Module -Force -AllowClobber -ErrorAction "Stop" -Confirm:$false -Verbose:$false + $InstallModuleInvocation = Install-Module -Name $Module -Force -ErrorAction "Stop" -Confirm:$false -Verbose:$false Write-Output -InputObject "Module $($Module) installed successfully" } } diff --git a/Scripts/New-AppAssignment.ps1 b/Scripts/New-AppAssignment.ps1 index 619144a..3514210 100644 --- a/Scripts/New-AppAssignment.ps1 +++ b/Scripts/New-AppAssignment.ps1 @@ -20,25 +20,38 @@ #> [CmdletBinding(SupportsShouldProcess = $true)] param ( - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] [ValidateNotNullOrEmpty()] [string]$TenantID, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] [ValidateNotNullOrEmpty()] [string]$ClientID, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] [ValidateNotNullOrEmpty()] - [string]$ClientSecret + [string]$ClientSecret, + + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] + [ValidateNotNullOrEmpty()] + [System.Security.Cryptography.X509Certificates.X509Certificate2]$ClientCertificate ) Process { # Construct path for AppsAssignList.json file created in previous stage $AppsAssignListFileName = "AppsAssignList.json" $AppsAssignListFilePath = Join-Path -Path (Join-Path -Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY -ChildPath "AppsPublishedList") -ChildPath $AppsAssignListFileName - # Retrieve authentication token using client secret from key vault - $AuthToken = Connect-MSIntuneGraph -TenantID $TenantID -ClientID $ClientID -ClientSecret $ClientSecret -ErrorAction "Stop" + # Retrieve authentication token using client secret from key vault or client certificate + switch ($PSCmdlet.ParameterSetName) { + "ClientSecret" { + $AuthToken = Connect-MSIntuneGraph -TenantID $TenantID -ClientID $ClientID -ClientSecret $ClientSecret -ErrorAction "Stop" + } + "ClientCertificate" { + $AuthToken = Connect-MSIntuneGraph -TenantID $TenantID -ClientID $ClientID -ClientCert $ClientCertificate -ErrorAction "Stop" + } + } if (Test-Path -Path $AppsAssignListFilePath) { # Read content from AppsAssignList.json file and convert from JSON format diff --git a/Scripts/New-Win32App.ps1 b/Scripts/New-Win32App.ps1 index 15bb4fb..a029dcd 100644 --- a/Scripts/New-Win32App.ps1 +++ b/Scripts/New-Win32App.ps1 @@ -22,23 +22,31 @@ #> [CmdletBinding(SupportsShouldProcess = $true)] param ( - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] [ValidateNotNullOrEmpty()] [string]$TenantID, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] [ValidateNotNullOrEmpty()] [string]$ClientID, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] [ValidateNotNullOrEmpty()] [string]$ClientSecret, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] + [ValidateNotNullOrEmpty()] + [System.Security.Cryptography.X509Certificates.X509Certificate2]$ClientCertificate, + + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] [ValidateNotNullOrEmpty()] [string]$WorkspaceID, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] [ValidateNotNullOrEmpty()] [string]$SharedKey ) @@ -150,8 +158,15 @@ Process { $AppsPublishListFileName = "AppsPublishList.json" $AppsPublishListFilePath = Join-Path -Path (Join-Path -Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY -ChildPath "AppsPublishList") -ChildPath $AppsPublishListFileName - # Retrieve authentication token using client secret from key vault - $AuthToken = Connect-MSIntuneGraph -TenantID $TenantID -ClientID $ClientID -ClientSecret $ClientSecret -ErrorAction "Stop" + # Retrieve authentication token using client secret from key vault or client certificate + switch ($PSCmdlet.ParameterSetName) { + "ClientSecret" { + $AuthToken = Connect-MSIntuneGraph -TenantID $TenantID -ClientID $ClientID -ClientSecret $ClientSecret -ErrorAction "Stop" + } + "ClientCertificate" { + $AuthToken = Connect-MSIntuneGraph -TenantID $TenantID -ClientID $ClientID -ClientCert $ClientCertificate -ErrorAction "Stop" + } + } if (Test-Path -Path $AppsPublishListFilePath) { # Read content from AppsPublishList.json file and convert from JSON format diff --git a/Scripts/Prepare-AppPackageFolder.ps1 b/Scripts/Prepare-AppPackageFolder.ps1 index 6932145..c541299 100644 --- a/Scripts/Prepare-AppPackageFolder.ps1 +++ b/Scripts/Prepare-AppPackageFolder.ps1 @@ -61,14 +61,14 @@ Process { Copy-Item -Path "$($FrameworkPath)\*" -Destination $AppPublishFolderPath -Recurse -Force -Confirm:$false # Create Files folder in Source folder if not found - $AppsPublishSourceFilesPath = Join-Path -Path $AppsPublishRootPath -ChildPath "$($App.AppFolderName)\Source\Files" - if (-not(Test-Path -Path $AppsPublishSourceFilesPath)) { - New-Item -Path $AppsPublishSourceFilesPath -ItemType "Directory" -Force -Confirm:$false | Out-Null + $AppPublishSourceFilesPath = Join-Path -Path $AppPublishFolderPath -ChildPath "Source\Files" + if (-not(Test-Path -Path $AppPublishSourceFilesPath)) { + New-Item -Path $AppPublishSourceFilesPath -ItemType "Directory" -Force -Confirm:$false | Out-Null } # Copy app specific installer from downloaded app package path to publish folder $AppInstallerPath = Join-Path -Path $App.AppSetupFolderPath -ChildPath $App.AppSetupFileName - $AppInstallerDestinationPath = Join-Path -Path $AppPublishFolderPath -ChildPath "Source\Files\$($App.AppSetupFileName)" + $AppInstallerDestinationPath = Join-Path -Path $AppPublishSourceFilesPath -ChildPath $App.AppSetupFileName Write-Output -InputObject "Copying installer file from app package download folder" Write-Output -InputObject "Source path: $($AppInstallerPath)" Write-Output -InputObject "Destination path: $($AppInstallerDestinationPath)" @@ -76,7 +76,21 @@ Process { # Copy all required app specific files from app package folder in Apps root folder to publish folder $AppPackageFolderPath = Join-Path -Path $SourceDirectory -ChildPath "Apps\$($App.AppFolderName)" - $AppFileNames = $AppFileNames = @("App.json", "Deploy-Application.ps1", "Icon.png") + + # Copy SupportFiles folder from app package folder in Apps root to Source folder if it exists and is not empty + $AppSupportFilesPath = Join-Path -Path $AppPackageFolderPath -ChildPath "SupportFiles" + if (Test-Path -Path "$AppSupportFilesPath\*") { + Copy-Item -Path $AppSupportFilesPath -Destination "$AppPublishFolderPath\Source" -Container -Recurse -Force -Confirm:$false + } + + # Read app specific App.json manifest and convert from JSON + $AppDataFile = Join-Path -Path $AppPackageFolderPath -ChildPath "App.json" + $AppData = Get-Content -Path $AppDataFile | ConvertFrom-Json + + # Get app icon file name + $IconFileName = if (-not([string]::IsNullOrEmpty($AppData.PackageInformation.IconFile))) { $AppData.PackageInformation.IconFile } else { "Icon.png" } + + $AppFileNames = $AppFileNames = @("App.json", "Deploy-Application.ps1", $IconFileName) foreach ($AppFileName in $AppFileNames) { Write-Output -InputObject "[FILE: $($AppFileName)] - Processing" @@ -102,7 +116,25 @@ Process { Write-Output -InputObject "Setting timestamp to: $((Get-Date).ToShortDateString())" $AppFileContent = $AppFileContent -replace "###DATETIME###", (Get-Date).ToShortDateString() Write-Output -InputObject "Setting setup file name to: $($App.AppSetupFileName)" - $AppFileContent = $AppFileContent -replace "###SETUPFILENAME###", $($App.AppSetupFileName) + $AppFileContent = $AppFileContent -replace "###SETUPFILENAME###", $App.AppSetupFileName + Write-Output -InputObject "Setting PSADT pre-install section to: $($AppData.PSADT.PreInstallSection)" + $AppFileContent = $AppFileContent -replace "###PREINSTALLSECTION###", $AppData.PSADT.PreInstallSection + Write-Output -InputObject "Setting PSADT install section to: $($AppData.PSADT.InstallSection)" + $AppFileContent = $AppFileContent -replace "###INSTALLSECTION###", $AppData.PSADT.InstallSection + Write-Output -InputObject "Setting PSADT post-install section to: $($AppData.PSADT.PostInstallSection)" + $AppFileContent = $AppFileContent -replace "###POSTINSTALLSECTION###", $AppData.PSADT.PostInstallSection + Write-Output -InputObject "Setting PSADT pre-uninstall section to: $($AppData.PSADT.PreUninstallSection)" + $AppFileContent = $AppFileContent -replace "###PREUNINSTALLSECTION###", $AppData.PSADT.PreUninstallSection + Write-Output -InputObject "Setting PSADT uninstall section to: $($AppData.PSADT.UninstallSection)" + $AppFileContent = $AppFileContent -replace "###UNINSTALLSECTION###", $AppData.PSADT.UninstallSection + Write-Output -InputObject "Setting PSADT post-uninstall section to: $($AppData.PSADT.PostUninstallSection)" + $AppFileContent = $AppFileContent -replace "###POSTUNINSTALLSECTION###", $AppData.PSADT.PostUninstallSection + Write-Output -InputObject "Setting PSADT pre-repair section to: $($AppData.PSADT.PreRepairSection)" + $AppFileContent = $AppFileContent -replace "###PREREPAIRSECTION###", $AppData.PSADT.PreRepairSection + Write-Output -InputObject "Setting PSADT repair section to: $($AppData.PSADT.RepairSection)" + $AppFileContent = $AppFileContent -replace "###REPAIRSECTION###", $AppData.PSADT.RepairSection + Write-Output -InputObject "Setting PSADT post-repair section to: $($AppData.PSADT.PostRepairSection)" + $AppFileContent = $AppFileContent -replace "###POSTREPAIRSECTION###", $AppData.PSADT.PostRepairSection # Read and update hardcoded variables with specific MSI data from setup file if file extension is MSI $SetupFileNameExtension = [System.IO.Path]::GetExtension($App.AppSetupFileName).Trim(".") @@ -128,6 +160,12 @@ Process { Write-Output -InputObject "File path: $($AppFilePath)" $AppFileContent = Get-Content -Path $AppFilePath | ConvertFrom-Json + # Add timestamp to Notes property + if ($AppFileContent.Information.Notes -match "(\#{3})DATETIME(\#{3})") { + Write-Output -InputObject "Setting Notes timestamp to: $(Get-Date -Format yyyy-MM-dd)" + $AppFileContent.Information.Notes = $AppFileContent.Information.Notes -replace "###DATETIME###", (Get-Date -Format yyyy-MM-dd) + } + # Update version specific property values $AppFileContent.Information.DisplayName = $App.IntuneAppName $AppFileContent.Information.AppVersion = $App.AppSetupVersion @@ -255,7 +293,7 @@ Process { Write-Output -InputObject "Creating '$($AppFileName)' in: $($AppFileDestinationPath)" Out-File -InputObject ($AppFileContent | ConvertTo-Json) -FilePath $AppFileDestinationPath -Encoding "utf8" -Force -Confirm:$false } - "Icon.png" { + $IconFileName { # If IconURL attribute is present for current app item, download icon from URL to the app package folder in the publish root folder if (-not([string]::IsNullOrEmpty($App.IconURL))) { Write-Output -InputObject "Downloading icon file from URL: $($App.IconURL)" @@ -271,9 +309,6 @@ Process { Write-Output -InputObject "Destination path: $($AppFileDestinationPath)" Copy-Item -Path $AppFilePath -Destination $AppFileDestinationPath -Force -Confirm:$false } - - # Declare the icon file name to set in the current app item attribute for IconFileName - $IconFileName = $AppFileName } } diff --git a/Scripts/Test-AppFiles.ps1 b/Scripts/Test-AppFiles.ps1 index 4a8789b..09fe9d4 100644 --- a/Scripts/Test-AppFiles.ps1 +++ b/Scripts/Test-AppFiles.ps1 @@ -101,26 +101,28 @@ Process { } } else { - Write-Warning -Message "Icon URL was defined but value was empty, checking for local Icon.png file" - $IconFilePath = Join-Path -Path $AppPackageFolderPath -ChildPath "Icon.png" + $IconFile = $AppFileContent.PackageInformation.IconFile + Write-Warning -Message "Icon URL was defined but value was empty, checking for local $IconFile file" + $IconFilePath = Join-Path -Path $AppPackageFolderPath -ChildPath $IconFile if (-not(Test-Path -Path $IconFilePath)) { - Write-Warning -Message "Could not detect local Icon.png file in app folder" + Write-Warning -Message "Could not detect local $IconFile file in app folder" $AppAllowed = $false } else { - Write-Output -InputObject "Found local Icon.png file in app folder" + Write-Output -InputObject "Found local $IconFile file in app folder" } } } else { - Write-Output -InputObject "Icon URL was not defined, testing for local Icon.png file" - $IconFilePath = Join-Path -Path $AppPackageFolderPath -ChildPath "Icon.png" + $IconFile = $AppFileContent.PackageInformation.IconFile + Write-Output -InputObject "Icon URL was not defined, testing for local $IconFile file" + $IconFilePath = Join-Path -Path $AppPackageFolderPath -ChildPath $IconFile if (-not(Test-Path -Path $IconFilePath)) { - Write-Warning -Message "Could not detect local Icon.png file in app folder" + Write-Warning -Message "Could not detect local $IconFile file in app folder" $AppAllowed = $false } else { - Write-Output -InputObject "Found local Icon.png file in app folder" + Write-Output -InputObject "Found local $IconFile file in app folder" } } @@ -166,6 +168,7 @@ Process { "AppSource" = $App.AppSource "AppId" = if (-not([string]::IsNullOrEmpty($App.AppId))) { $App.AppId } else { [string]::Empty } "AppFolderName" = $App.AppFolderName + "AppSetupFileName" = $App.AppSetupFileName "FilterOptions" = $App.FilterOptions "StorageAccountName" = if (-not([string]::IsNullOrEmpty($App.StorageAccountName))) { $App.StorageAccountName } else { [string]::Empty } "StorageAccountContainerName" = if (-not([string]::IsNullOrEmpty($App.StorageAccountContainerName))) { $App.StorageAccountContainerName } else { [string]::Empty } diff --git a/Scripts/Test-AppList.ps1 b/Scripts/Test-AppList.ps1 index 99c34b0..e3168bb 100644 --- a/Scripts/Test-AppList.ps1 +++ b/Scripts/Test-AppList.ps1 @@ -26,19 +26,26 @@ #> [CmdletBinding(SupportsShouldProcess = $true)] param ( - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] [ValidateNotNullOrEmpty()] [string]$TenantID, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] [ValidateNotNullOrEmpty()] [string]$ClientID, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] [ValidateNotNullOrEmpty()] [string]$ClientSecret, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] + [ValidateNotNullOrEmpty()] + [System.Security.Cryptography.X509Certificates.X509Certificate2]$ClientCertificate, + + [parameter(Mandatory = $true, ParameterSetName = "ClientSecret")] + [parameter(Mandatory = $true, ParameterSetName = "ClientCertificate")] [ValidateNotNullOrEmpty()] [string]$StorageAccountAccessKey ) @@ -285,8 +292,15 @@ Process { $SourceDirectory = $env:BUILD_SOURCESDIRECTORY try { - # Retrieve authentication token using client secret from key vault - $AuthToken = Get-AccessToken -TenantID $TenantID -ClientID $ClientID -ClientSecret $ClientSecret -ErrorAction "Stop" + # Authenticate with MS Graph using client secret from key vault or client certificate + switch ($PSCmdlet.ParameterSetName) { + "ClientSecret" { + Connect-MSIntuneGraph -TenantID $TenantID -ClientID $ClientID -ClientSecret $ClientSecret -ErrorAction "Stop" | Out-Null + } + "ClientCertificate" { + Connect-MSIntuneGraph -TenantID $TenantID -ClientID $ClientID -ClientCert $ClientCertificate -ErrorAction "Stop" | Out-Null + } + } # Construct list of applications to be processed in the next stage $AppsDownloadList = New-Object -TypeName "System.Collections.ArrayList" @@ -341,8 +355,12 @@ Process { Write-Output -InputObject "URI: $($AppItem.URI)" try { - # Attempt to deserialize the setup file name from the URI - $AppSetupFileName = [Uri]$AppItem.URI | Select-Object -ExpandProperty "Segments" | Select-Object -Last 1 + # Determine app setup file name + $AppSetupFileName = $App.AppSetupFileName + if ([string]::IsNullOrEmpty($AppSetupFileName)) { + # Attempt to deserialize the setup file name from the URI + $AppSetupFileName = [Uri]$AppItem.URI | Select-Object -ExpandProperty "Segments" | Select-Object -Last 1 + } Write-Output -InputObject "Setup file name: $($AppSetupFileName)" try { @@ -365,64 +383,53 @@ Process { } } - # Attempt to locate the application in Intune + # Attempt to locate the application in Intune matching DisplayName Write-Output -InputObject "Attempting to find application in Intune using naming convention: $($AppDisplayName)" - $Win32AppResources = Invoke-MSGraphOperation -Get -APIVersion "Beta" -Resource "deviceAppManagement/mobileApps?`$filter=isof('microsoft.graph.win32LobApp')" - if ($Win32AppResources -ne $null) { - - # Detect Win32 application matching displayName - $Win32Apps = $Win32AppResources | Where-Object { $PSItem.displayName -like "$($AppDisplayName)*" } - if ($Win32Apps -ne $null) { - $Win32AppsCount = ($Win32Apps | Measure-Object).Count - Write-Output -InputObject "Count of detected Intune Win32 applications: $($Win32AppsCount)" - } - else { - Write-Output -InputObject "Application with defined name '$($AppDisplayName)' was not found, adding to download list" - - # Mark new application to be published - $AppDownload = $true - } - - # Filter for the latest version published in Intune, if multiple applications objects was detected - $Win32AppLatestPublishedVersion = $Win32Apps.displayVersion | Where-Object { $PSItem -as [System.Version] } | Sort-Object { [System.Version]$PSItem } -Descending | Select-Object -First 1 - - # Version validation and conversion if necessary - if (Test-Version -Version $AppItem.Version) { - Write-Output -InputObject "Version string is valid" - } - else { - Write-Output -InputObject "Version string contains invalid characters, attempting to convert" - $AppItem.Version = ConvertTo-Version -Version $AppItem.Version - Write-Output -InputObject "Converted version string: $($AppItem.Version)" - } + $Win32Apps = Get-IntuneWin32App -DisplayName $AppDisplayName + if ($Win32Apps -ne $null) { + $Win32AppsCount = ($Win32Apps | Measure-Object).Count + Write-Output -InputObject "Count of detected Intune Win32 applications: $($Win32AppsCount)" + } + else { + Write-Output -InputObject "Application with defined name '$($AppDisplayName)' was not found, adding to download list" - # Perform version comparison check - Write-Output -InputObject "Performing version comparison check to determine if a newer version of the application exists" - if ([System.Version]$AppItem.Version -gt [System.Version]$Win32AppLatestPublishedVersion) { - # Determine value for published version if not found - if ($Win32AppLatestPublishedVersion -eq $null) { - $Win32AppLatestPublishedVersion = "Not found" - } - - Write-Output -InputObject "Newer version exists for application, version details:" - Write-Output -InputObject "Latest version: $($AppItem.Version)" - Write-Output -InputObject "Published version: $($Win32AppLatestPublishedVersion)" - Write-Output -InputObject "Adding application to download list" - - # Mark new application version to be published - $AppDownload = $true - } - else { - Write-Output -InputObject "Latest version of application is already published" + # Mark new application to be published + $AppDownload = $true + } + + # Filter for the latest version published in Intune, if multiple applications objects was detected + $Win32AppLatestPublishedVersion = $Win32Apps.displayVersion | Where-Object { $PSItem -as [System.Version] } | Sort-Object { [System.Version]$PSItem } -Descending | Select-Object -First 1 + + # Version validation and conversion if necessary + if (Test-Version -Version $AppItem.Version) { + Write-Output -InputObject "Version string is valid" + } + else { + Write-Output -InputObject "Version string contains invalid characters, attempting to convert" + $AppItem.Version = ConvertTo-Version -Version $AppItem.Version + Write-Output -InputObject "Converted version string: $($AppItem.Version)" + } + + # Perform version comparison check + Write-Output -InputObject "Performing version comparison check to determine if a newer version of the application exists" + if ([System.Version]$AppItem.Version -gt [System.Version]$Win32AppLatestPublishedVersion) { + # Determine value for published version if not found + if ($Win32AppLatestPublishedVersion -eq $null) { + $Win32AppLatestPublishedVersion = "Not found" } + + Write-Output -InputObject "Newer version exists for application, version details:" + Write-Output -InputObject "Latest version: $($AppItem.Version)" + Write-Output -InputObject "Published version: $($Win32AppLatestPublishedVersion)" + Write-Output -InputObject "Adding application to download list" + + # Mark new application version to be published + $AppDownload = $true } else { - Write-Warning -Message "Unhandled error occurred, application will be skipped" - - # Handle current application output completed message - Write-Output -InputObject "[APPLICATION: $($App.IntuneAppName)] - Skipped" + Write-Output -InputObject "Latest version of application is already published" } - + # Add current app to list if publishing is required if ($AppDownload -eq $true) { # Construct new application custom object with required properties diff --git a/Templates/Application/App.json b/Templates/Application/App.json index d17d45d..41ce26b 100644 --- a/Templates/Application/App.json +++ b/Templates/Application/App.json @@ -12,7 +12,7 @@ "AppVersion": "", "Description": "<>", "Publisher": "", - "Notes": "<>", + "Notes": "Created by IntuneAppFactory on ###DATETIME###", "Owner": "<>", "ScopeTagName": "<>" }, @@ -23,6 +23,17 @@ "DeviceRestartBehavior": "<>", "AllowAvailableUninstall": "<>" }, + "PSADT": { + "PreInstallSection": "", + "InstallSection": "<>", + "PostInstallSection": "", + "PreUninstallSection": "", + "UninstallSection": "<>", + "PostUninstallSection": "", + "PreRepairSection": "", + "RepairSection": "", + "PostRepairSection": "" + }, "RequirementRule": { "MinimumSupportedWindowsRelease": "<>", "Architecture": "<>" diff --git a/Templates/Application/Deploy-Application.ps1 b/Templates/Application/Deploy-Application.ps1 index 7d2f1b9..02b3086 100644 --- a/Templates/Application/Deploy-Application.ps1 +++ b/Templates/Application/Deploy-Application.ps1 @@ -126,6 +126,7 @@ Try { #Show-InstallationProgress ## + ###PREINSTALLSECTION### ## SAMPLE: Uninstall any previous versions of application by calling the command from Uninstall-string #Remove-MSIApplications -Name "" @@ -145,6 +146,7 @@ Try { } ## ******************************************* + ###INSTALLSECTION### ## SAMPLE: EXE #$exeInstall = "###SETUPFILENAME###" @@ -183,6 +185,7 @@ Try { [string]$installPhase = 'Post-Installation' ## + ###POSTINSTALLSECTION### ## Display a message at the end of the install #If (-not $useDefaultMsi) { Show-InstallationPrompt -Message 'You can customize text to appear at the end of an install or remove it completely for unattended installations.' -ButtonRightText 'OK' -Icon Information -NoWait } @@ -201,6 +204,7 @@ Try { #Show-InstallationProgress ## + ###PREUNINSTALLSECTION### ##*=============================================== ##* UNINSTALLATION @@ -214,6 +218,7 @@ Try { } # ******************************************* + ###UNINSTALLSECTION### ## SAMPLE: Uninstall any previous versions of application by calling the command from Uninstall-string #Remove-MSIApplications -Name "" @@ -227,6 +232,7 @@ Try { [string]$installPhase = 'Post-Uninstallation' ## + ###POSTUNINSTALLSECTION### }