Configuration Manager 2012 Add App-V Application with Powershell

I had the need to add a few App-V applications to my Configuration Manager environment and created a script to simplify this. The script will extract information from the App-V manifest XML file and use the application name and application version when adding the application to the SCCM. The script will also create a deployment type to the SCCM application.

To run the script just execute the following command in a PowerShell shell:
AddCMAppV.ps1 –APPFilePath ‘\\SCCM\PKG\App1\app1_manifest.xml’

PowerShell script

    # Variables
    $Manufacturer = “”
    $ProductVersion = “”
    $ProductName = “”
    $PWDBegin = $PWD
    $CMSiteCode = “P01” # Change this – This should be your site code
    $CMModule = ‘C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1’ # Change this – This should point to the CM module
    $APPFileName = $APPFilePath.split(“\”)[-1]
    Write-Host “FileName: ” $APPFileName
    If ($APPFileName.split(“.”)[-1].ToLower() -ne “xml”)
        Write-Host “ERROR – The file “”$APPFileName”” is not a XML file”
    If ((Test-Path $APPFilePath) -eq $False)
        Write-Host “ERROR – The path “”$APPFilePath”” is not correct”
    # Get AppV information
    $AppInfo = Get-Content $APPFilePath
    Import-Module $CMModule
    $CMSiteCode = $CMSiteCode + “:”
    Set-Location $CMSiteCode
    If ((Get-CMApplication -Name “$AppName $AppVersion”) -ne $NULL)
        Write-Host “ERROR – CM Application with name “”$AppName $AppVersion”” already exist”
        Write-Host “Adding CM Application: “”$AppName $AppVersion”””
        New-CMApplication -Name “$AppName $AppVersion” -SoftwareVersion $AppVersion
    If ((Get-CMDeploymentType -ApplicationName “$AppName $AppVersion” -DeploymentTypeName $AppName) -ne $NULL)
        Write-Host “ERROR – CM Deployment Type with name “”$AppName”” already exist”
        Set-Location $PWDBegin
        Write-Host “Adding CM Deployment Type: “”$AppName”””
        Add-CMDeploymentType -ApplicationName “$AppName $AppVersion” -DeploymentTypeName “$AppName” -AdministratorComment “Created by PowerShell” -InstallationFileLocation $APPFilePath -AutoIdentifyFromInstallationFile -ForceForUnknownPublisher $True -AppvInstaller
    Set-Location $PWDBegin

Add many applications to SCCM 2012

To add more than one application just create a CMD file with the following information and put in the same directory as the PowerShell script file.

powershell.exe .\AddCMAppV.ps1 -APPFilePath ‘\\SCCM201201\Apps$\App-V\Skype\Skype_V5\Skype_V5_manifest.xml’
powershell.exe .\AddCMAppV.ps1 -APPFilePath ‘\\SCCM201201\Apps$\App-V\Firefox\firefox.001\firefox.001_manifest.xml’

One Response to Configuration Manager 2012 Add App-V Application with Powershell

  1. fredyy June 26, 2017 at 00:51 #

    thank you for all
    I have a question
    I retrieved the information from an application with the command Get-Cmapplication – name “****”
    After I deleted this Application (****)
    How to remix this application (****) in production with powershell

    I’m really stuck on this subject
    Thank you for your help

Leave a Reply