Jaa


Part 3 – App-V 5.0 and Configuration Manager 2012 SP1 – App-V 5.0 Application Creation

Hi all,

In part 1 we introduced how you can leverage and use the Configuration Manager Powershell cmdlets and then in part 2 we showed you how to automatically create a user collection but let’s see how we can now add a new App-V 5.0 application.

Creating the Application

The first thing I need to do is load the Configuration Manager cmdlets. I’ve also added the following variables:

· $AD_UserGroup – AD Security group for application distribution

· $App_Name – The name I want to call the application in Configuration Manager

· $App_DT_Name – The display name of the deployment type

· $App_Source_Location – The location of my App-V 5.0 application

$CM_Module = "D:\ConfigMgr\AdminConsole\bin\ConfigurationManager.psd1"

$AD_UserGroup = "AppV_Notepad_5.9"

$App_Name = "Notepad++ 5.9"

$App_DT_Name = "Notepad++ 5.9 - App-V 5.0"

$App_Source_Location = "\\LAB-CONFIGMGR\d$\Source\App-V Applications\5.0\Notepad++ 5.9\Notepad++ 5.9.appv"

Import-Module $CM_Module

cd PRI:

Now the module has been loaded I’m going to create my application using the following cmdlet New-CMApplication, but before I do this I need to understand how to use it. To get this information you can run the following which provides me with all the syntax.

Get-help New-CMApplication

NAME

New-CMApplication

SYNTAX

New-CMApplication -Name <string> [-OptionalReference <string>] [-ReleaseDate <datetime>] [-AutoInstall <bool>]

[-Owner <string>] [-SupportContact <string>] [-LocalizedApplicationName <string>] [-UserDocumentation <string>]

[-LinkText <string>] [-LocalizedApplicationDescription <string>] [-Keyword <string>] [-Description <string>]

[-Manufacturer <string>] [-SoftwareVersion <string>] [-WhatIf] [-Confirm] [<CommonParameters>]

Before I run the cmdlet lets have a look at my “Applications” before running the script, as you can see there is no application called “Notepad++ 5.9” created.

image

The command that I’m going to run is below, I’m using the variable $App_Name to be the name of my Application. Note: You can review the help command above for the extra parameters.

# Create new application

New-CMApplication -Name $App_Name

Now the Application has been created and within the Console it’s now populated.

Powershell

image

Configuration Manager Console

image

As simple as that, my application has been created but as you can see there is no Deployment Type created, which means there is no application to deploy to our clients.

image

So how do I now create a deployment type through Powershell? We can leverage the Add-CMDeploymentType cmdlet.

Get-help Add-CMDeploymentType

NAME

Add-CMDeploymentType

SYNTAX

Add-CMDeploymentType -ApplicationName <string> -AppV5xInstaller -AutoIdentifyFromIntallationFile

-InstallationFileLocation <string> -ForceForUnknownPublisher <bool> [-DeploymentTypeName <string>]

[-AdministratorComment <string>] [-Language <string[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

I’m adding the deployment type to the previously created application $App_Name, I’m then specifying the name for the deployment type from the variable $App_DT_Name and then the important parameter “-AppV5xInstaller”. Then final piece is the installation file location which is using the variable $App_Source_Location specified in my variable list.

# Add deployment using App-V 5.0 Source Files

Add-CMDeploymentType -ApplicationName $App_Name -DeploymentTypeName $App_DT_Name -AppV5xInstaller -AutoIdentifyFromIntallationFile -ForceForUnknownPublisher $true -InstallationFileLocation $App_Source_Location

Now the deployment type has been created.

Powershell

image

Configuration Manager Console

image

I’m really happy now, Application has been created, Deployment Type created but did anyone spot something that I didn’t have an option to configure????

image

I actually want to stream my application from the distribution point, not “Download content from distribution point and run locally”. So how do I do that?

I did some research and found the command Set-CMDeploymentType, the explanation is below.

NAME

Set-CMDeploymentType

SYNTAX

Set-CMDeploymentType [-WhatIf] [-Confirm] [<CommonParameters>]

Set-CMDeploymentType -DeploymentTypeName <string> -ApplicationName <string> -AppV5xInstaller

[-NewDeploymentTypeName <string>] [-AdministratorComment <string>] [-Language <string[]>] [-ContentLocation

<string>] [-PersistContentInClientCache <bool>] [-EnablePeertoPeerContentDistribution <bool>] [-OnFastNetworkMode

<OnFastNetworkMode> {RunLocal | RunFromNetwork}] [-OnSlowNetworkMode <ContentHandlingMode> {DoNothing | Download |

DownloadContentForStreaming}] [-AllowClientsToUseFallbackSourceLocationForContent <bool>] [-WhatIf] [-Confirm]

[<CommonParameters>]

Now I have the option to change the “OnFastNetworkMode” to streaming. As before I need to use the Application I previous created and then specify the Deployment Type I want to manipulate, you can then see the manipulation of the “OnFastNetworkMode” to RunFromNetwork and then setting “OnSlowNetworkMode” to Download and execute.

# Changing deployment type to stream application on fast network

Set-CMDeploymentType -ApplicationName $App_Name -DeploymentTypeName $App_DT_Name -AppV5xInstaller -OnFastNetworkMode RunFromNetwork -OnSlowNetworkMode Download -AllowClientsToUseFallbackSourceLocationForContent $true

Powershell

image

Configuration Manager Console

image

Now everything is set how I want, now lets look how I can automatically distribute my content. For this I’m going to use the Get-CMDistributionPoint cmdlet.

NAME

Get-CMDistributionPoint

SYNTAX

Get-CMDistributionPoint [-SiteSystemServerName <string>] [-SiteCode <string>] [<CommonParameters>]

Get-CMDistributionPoint -DistributionPointGroupName <string> [<CommonParameters>]

Get-CMDistributionPoint -DistributionPointGroupId <string> [<CommonParameters>]

Get-CMDistributionPoint -DistributionPointGroup <IResultObject#SMS_DistributionPointGroup> [<CommonParameters>]

When I run this command the following is outputted.

image

In my environment I only have one distribution point so this should be simple.

What I found in my testing was that when you start a deployment you have to specify the distribution point without the “\\” so I need to complete this with Powershell. What I’m doing in getting the DP with the variable $CM_DP, from there I’m setting the NetworkOSPath property in another variable $CM_NOSP so that I can manipulate it. Finally I need to remove the double backslash so I’m using the inbuilt TrimStart Method to remove these characters.

# Getting distribution point network path

$CM_DP = Get-CMDistributionPoint

$CM_NOSP = $CM_DP.NetworkOSPath

# Need to change the DP Path to remove the starting \\

$CM_DPN = $CM_NOSP.TrimStart("\\")

Now I’m ready to start my distribution of my content.

Note: If you have multiple distribution point you could easily put this in a for loop.

I’m using the Start-CMContentDistribution cmdlet to complete this.

NAME

Start-CMContentDistribution

SYNTAX

Start-CMContentDistribution -ApplicationName <string[]> [-DisableDetectAssociatedContentDependencies]

[-CollectionName <string>] [-DistributionPointName <string>] [-DistributionPointGroupName <string>] [-WhatIf]

[-Confirm] [<CommonParameters>]

Below is the command I used, again the $App_Name is used so it just distributes this application and then the Distribution point is specified.

# Distributing content to DP

Start-CMContentDistribution -ApplicationName $App_Name -DistributionPointName $CM_DPN

Powershell

image

Configuration Manager Console

image

The application has been created, the deployment type is created and configured and the content has been distributed

But you can see from the console nothing has been deployed so how do I deploy the application to a User Collection.

image

Now to the final Powershell cmdlet of this post, Start-CMApplicationDeployment.

NAME

Start-CMApplicationDeployment

SYNTAX

Start-CMApplicationDeployment -CollectionName <string> -Name <string[]> [-Comment <string>] [-DeployAction

<DeployActionType> {Install | Uninstall}] [-DeployPurpose <DeployPurposeType> {Available | Required}]

[-AppRequiresApproval <bool>] [-PreDeploy <bool>] [-SendWakeUpPacket <bool>] [-UseMeteredNetwork <bool>]

[-TimeBaseOn <TimeType> {LocalTime | UTC}] [-AvaliableDate <datetime>] [-AvaliableTime <datetime>] [-DeadlineDate

<datetime>] [-DeadlineTime <datetime>] [-UserNotification <UserNotificationType> {DisplayAll |

DisplaySoftwareCenterOnly | HideAll}] [-OverrideServiceWindow <bool>] [-RebootOutsideServiceWindow <bool>]

[-PersistOnWriteFilterDevice <bool>] [-SuccessParameterValue <int>] [-PostponeDate <datetime>] [-PostponeTime

<datetime>] [-FailParameterValue <int>] [-EnableMomAlert <bool>] [-RaiseMomAlertsOnFailure <bool>] [-WhatIf]

[-Confirm] [<CommonParameters>]

I’m using the variable $AD_UserGroup for the collection name which was created in part 2 then the name of the application. Now its time to choose how to install the application, you have two choices – Available or Required (As per any script or solution this is your choice, but I’ve chosen to set it to available).

# Deploying application to Collection and setting to Install and Available

Start-CMApplicationDeployment -CollectionName $AD_UserGroup -Name $App_Name -DeployAction Install -DeployPurpose Available -UserNotification DisplayAll

Powershell

image

Configuration Manager Console

image

 The application has now been added, distributed and deployed through Powershell. If I now log onto my client machine with a user that’s a member of the AppV_Notepad_5.9 group, the application is available in the Application Catalog.

image

Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.

Conclusion

I hope this blog has helped you understand how to create your application and deployment type, distribute the content and then finally deploy it to your clients. More blogs posts of Configuration Manager and App-V 5.0 integration coming soon…

David Falkus | Premier Field Engineer | Application Virtualization

Comments

  • Anonymous
    January 01, 2003
    Excellent Guides Wed, Sep 18 2013 12:49 PM Thanks a lot David!! These are very helpful..

  • Anonymous
    January 01, 2003
    BTW I just found out that I had to tweak 1 step which is basically remove the part -> -DeploymentTypeName $App_DT_Name Also fixed a Type for -AutoIdentifyFromInstallationFile -> s is missing in Installation

Add deployment using App-V 5.0 Source Files

Add-CMDeploymentType -ApplicationName $App_Name -AppV5xInstaller -AutoIdentifyFromInstallationFile -ForceForUnknownPublisher $true -InstallationFileLocation $App_Source_Location Hope this helps :)

  • Anonymous
    September 18, 2013
    Thanks a lot David!! These are very helpful..