How to create batch of application in SCCM using powershell

This script will be creating a batch of application .EXE with detection method  from the csv file. We need to prepare the csv file with proper column names to import into PowerShell. This script is created based on a project requirement, you can change the application settings as per the requirement.

Below mentioned libraries need to be loaded in the initial stage of the script. Configuration manager installation path might be differ based on your infra. Change the path if required, As we are using WMI, we don’t need to PowerShell module for this script.

Add-Type -Path "C:Program Files (x86)Microsoft Configuration ManagerAdminConsolebinMicrosoft.ConfigurationManagement.ApplicationManagement.dll" 
Add-Type -Path "C:Program Files (x86)Microsoft Configuration ManagerAdminConsolebinMicrosoft.ConfigurationManagement.ApplicationManagement.MsiInstaller.dll"
Add-Type -Path "C:Program Files (x86)Microsoft Configuration ManagerAdminConsolebinMicrosoft.ConfigurationManagement.ApplicationManagement.Extender.dll" 
Add-Type -Path "C:Program Files (x86)Microsoft Configuration ManagerAdminConsolebinDcmObjectModel.dll" 
Add-Type -Path "C:Program Files (x86)Microsoft Configuration ManagerAdminConsolebinAdminUI.WqlQueryEngine.dll" 
Add-Type -Path "C:Program Files (x86)Microsoft Configuration ManagerAdminConsolebinAdminUI.AppManFoundation.dll"

Below is the script for connecting to the SCCM server, we need to give the server name to open the connection.

$connection = New-Object Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlConnectionManager
[void]$connection.Connect("SERVER")

Below are the CSV heading that we need to provide for the application details

$release = $appdetail.appversion
$description = $null
$description = $AppDetail.Appdescription
$install = $appdetail.AppInstall
$publisher = $appdetail.AppPublisher
$name = $AppDetail.apptitle
$file = $appdetail.Detection
$filename = $AppDetail.filename
$source = $appdetail.Appsource
$AppOwner = $appdetail.AppSponsor
$ApplicationSoftwareVersion = $appdetail.Appswversion
$DeploymentUninstallCommandLine = $appdetail.Appuninstall

Please download the complete script from GitHub repository.