Importing App-V apps in SCCM with Powershell

With the SCCM 2007 R2 release Microsoft delivers a VBScript to import and manage App-V applications. Because the limitations I wrote the import part in Powershell. The following script is only to import an App-V application and does not create a Collection or Advertisement.

To import an App-V application the following parameters are required.

$App = The App-V sequence name based on the directory name.
$Site = SCCM Site
$smsShare = The share of the SCCM server to copy the application to.
$AppShare = The share where the application is located.
$SCCMServer = SCCM Server Name.

The following function is to add the icon in SCCM.

Create a new directory based on the App-V application name and copy the application  from the source to the share.

Get the content from the manifest file of the App-V application.

Create the extended data variable.

Create an argument array for the package and apply the WMI data.

Collect the Package ID that is created by SCCM.

Rename the “sft” file to the package ID and remove the “sprj” file.

Create an argument array for the program and apply the WMI data.

All server distribution points that are Windows NT Server and has the role SMS Distribution Point are added to the an array.

Create an argument array for the distribution points and apply the WMI data.

Rename the SFT to the Packge ID in the OSD files.

Get the icon data and apply the WMI data for each OSD file.

After these steps the App-V package is available in SCCM. I used WMI explorer to collect specific settings for the packages. Configure the required settings and look for ProgramFlags and PkgFlags values with the WMI explorer.

The script is available in a text file that can be downloaded here.

NOTE: First test the script in a test environment before running in production. Use at your own risk!

If you have a question, suggestion or note please leave a comment.