End to End Application Packaging, Deployment and State Management using Server App-V

This blog post will cover a portion of my MMS session (AM-B316) and will be useful if you're looking to familiarize yourself with some of the key value propositions of Server App-V. This post will allow you to:

  • Grasp how packaging using the Server App-V Sequencer works
  • Understand how deployment with PowerShell is easy
  • Understand how Server App-V allows for application portability through state separation

This post has 3 sections; Packaging, Deployment and Application Portability. Enjoy!

1. Packaging

Required Installers:

  1. Server App-V Sequencer (RTM)
  2. Apache: httpd-2.2.17-win32-x86-openssl-0.9.9o.msi
  3. PHP: php-5.3.5-Win32-VC6-x86.msi
  4. PHPBB3: phpbb 3.0.8
  5. MySQL: mysql-essential-5.0.41-win32.msi


  1. You're an administrator on the sequencing work station
  2. All the installers and the files attached in the installphpbb.zip, at the end of the blog post below, are in c:\installers
    • Ensure the phpbb3.zip is extracted to C:\installers (i.e. C:\installers\phpbb3)
    • Ensure the installphpbb.zip is extracted to C:\installers (i.e. C:\installers\installphpbb.bat and C:\installers\httpd.conf)
  3. The Sequencer's virtual drive should remain as the default Q drive
  4. Sequencer OS is Windows Server 2008 R2 (I used Standard edition)


  1. Install the Server App-V Sequencer with all default settings. After installing the Server App-V Sequencer, launch it and select "Create a New Virtual Application Package"
  2. Resolve any issues that show up in the "Prepare the computer for creating a virtual package." screen and click Next
  3. Select perform a custom installation
  4. Name your virtual application package as BlogPhpBB and click next
  5. At the Install your applications now screen, you can now install the application
  6. Open Windows Explorer, navigate to C:\installers and run installphpbb.bat as administrator

Installing Apache

  1. After running installphpbb.bat, the Apache installer will launch
  2. Click Next in the Apache installer, accept the license agreement, click Next, click Next
  3. Make sure "for All Users, on Port 80, as a Service" is selected, click Next
  4. Select "Custom," click Next
  5. Confirm the install path is Q:\BlogPhpBB, click Next
  6. Click Install then Finish

Installing PHP

  1. After completing the Apache installation, the php installer will launch
  2. Click Next, accept the license agreement and click Next
  3. Confirm the install path is Q:\BlogPhpBB\PHP, click Next
  4. Select Apache 2.2.x Module, click Next
  5. Confirm the Apache Configuration Directory is Q:\BlogPhpBB\conf\
  6. Click Next, Click Install then Finish

Installing phpbb Application

At this stage the command prompt should show the phpbb folder being copied into your package. Once it completes, the MySQL installer will launch

Installing MySQL

  1. Click Next at the first screen
  2. Select Custom and click Next
  3. Confirm the install path is Q:\BlogPhpBB\MySQL\ click Next
  4. Click Install, Next, Next
  5. At the Wizard Completed screen, uncheck configure the MySQL Server now and click Finish
  6. The script will then configure MySQL then complete and exit
  7. At this point opening Internet Explorer, type in localhost in the address bar and IE will present the phpBB Installation Panel. Close IE (you can install phpBB to have the installation as part of the package if you choose, but for this post we won’t)

Complete Sequencing

  1. This should complete the packaging process. At this stage you can return to the Sequencer UI and check the box, "I am finished installing" and click Next
  2. The Sequencer will take a few moments to collect system changes and once that is complete the "Configure Software" screen will be presented. Since we don’t need to configure any software, click Next and the Sequencer will again collect additional changes that may have occurred in the case that we actually run any programs in the Configure Software screen
  3. The package will then be created and you should see the “Package Completed” screen. Some files may be excluded from the package and the following screen will be presented. Click close to see the Deployment Configuration screen for the package
  4. You can now review the deployment configuration for the package. The detected Apache and MySQL services will be displayed and browsing the various tabs should show you the package’s registry and file system etc.
  5. Click file and save your package. Create a folder named blogphpbb and save your package into that folder (it should have the default name blogphpbb). After saving, close the Sequencer and verify that your package contents are similar to the screenshot below
  6. Remember to copy the package folder off the sequencer machine to a network file share so that we can deploy it on another VM.


2. Deployment

Required Installers:

  1. Server App-V Agent (RTM)
  2. Server App-V Agent PowerShell cmdlets (RTM)
  3. PowerShell 2.0 (available by default on Windows Server 2008 R2)


  1. You're an administrator on the Agent work station
  2. The package folder is on a local drive, e.g. c:\packages\
  3. Agent OS is Windows Server 2008 R2 (I used Standard edition)


  1. Install the Server App-V Agent and Agent Cmdlets using default settings
  2. Launch PowerShell as administrator
  3. Run: import-module serverappvagent (note: you may need to turn remote signing on by running the following cmdlet: set-executionpolicy remotesigning –force)
  4. Run: add-serverappvpackage –name blogphpbb –manifest “path to manifest file” –SFT “path to SFT file” –configuration “path to deployment configuration file”
  5. The package will successfully add
  6. Start the virtual environment for the package by running: start-serverappvpackage blogphpbb
  7. At this point you can now launch IE, go to localhost and see the phpBB Installation Panel
  8. To get rid of the error on the top of the page open an elevated notepad and edit php.ini in the php installation directory - Q:\blogphpbb\php. Find the line that contains: '; date.timezone = ""' and replace it with: 'date.timezone = America/New_York' (without the single quotes, of course). Save the file and restart the Apache service from the Services control manager will effect the change
  9. At this stage you can proceed to complete the installation and customize your application

Configuring phpBB After Deployment

  1. Click the “Install” tab
  2. Click “proceed to next step”, then “start install”
  3. Provide the following information:
    • Db server:
    • Db server port: 3311
    • Db name: phpBB
    • Db username: root
    • Db pw: 123
  4. Click “proceed to next step”
  5. Provide the following information:
    • Administrator username: administrator
    • Administrator password: password
    • Contact email address: test@emailaddress.com
  6. Click “proceed to next step” until you reach to the congratulations screen. Ignore sending statistical information and click “Return to the ACP if you do not wish to send statistical information to phpBB”
  7. Click login to complete the installation
    • Delete the install directory under Q:\blogphpbb\htdocs so that you don’t see the admin control panel every time you access the application
  8. You can now configure your board to customize your installation from the Administration Control Panel (Board Configuration section). For example I modified Board setting to provide a site name and description. I also created new forums and categories from the Forums tab
  9. After completing configuring the application, proceed to the final step to learn how to manage your application’s state


3. Application Portability

Once a virtual application is running, the Server App-V Agent tracks all local state changes for the application. Server App-V separates the state changes from the immutable virtual application package. State changes include all configuration and file changes that are in the virtual environment. In this section we will illustrate how Server App-V allows you to move an application’s state from one machine to another.

Application portability is relevant for numerous scenarios. The most common scenario is when patching an OS. For example if you need to deploy a patched version of an OS and want to minimize unavailability of your application you can deploy the same application package from section 1 (Packaging) to a machine with the new, patched version of Windows Server, backup state from your non-patched version of Windows Server and restore the state on the new machine with the patched version of Windows Server. Once you verify that your application is working satisfactorily, you can choose when to make it available as you deprecate the already deployed server.

Backing Up Virtual Application State


  1. You're an administrator on the Agent work station
  2. The Server App-V Agent PowerShell Cmdlets are installed
  3. You are on a machine with a virtual package deployed (preferably the VM we just deployed the package in the Deployment section above)


  1. Since we made changes to our deployed virtual application we can perform a backup of our application state to capture all the local configuration drift that occurred post deployment
    • Note this will be performed on a machine with the Server App-V Agent and the Server App-V PowerShell cmdlets installed. the machine we deployed the package above will suffice
  2. Create a folder in the packagestate under the C drive (c:\packagestate)
  3. Launch PowerShell as administrator
  4. Run: import-module serverappvagent (note: you may need to turn remote signing on by running the following cmdlet: set-executionpolicyremotesigning –force)
  5. Backup the package state. Run backup-serverappvpackagestate blogphpbb c:\packagestate\
  6. You can browse to the package state location and confirm the package state was created
  7. You can now copy the package state from c:\packagestate to a network share


Restoring Virtual Application State

To illustrate how this occurs, we will deploy the virtual application package we packaged in section 1 (Packaging) to a new VM. To perform this, follow the instructions from section 2 (Deployment) until step 7 (At this point you can now launch IE, go to localhost and see the phpBB Installation Panel) then proceed with the instructions staying in the open PowerShell prompt.


  1. Using Windows Explorer, create a folder in the packagestate under the C drive (c:\packagestate)
  2. Run: import-module serverappvagent (note: you may need to turn remote signing on by running the following cmdlet: set-executionpolicyremotesigning –force)
  3. Restore the package state: restore-serverappvpackagestate blogphpbb c:\packagestate\
  4. Start the package: start-serverappvpackage blogphpbb
  5. You should now observe all the state changes from your previous machine applied to your new machine by launching IE and navigating to localhost

Thanks for reading. I hope this helps you understand how Server App-V can be used to simplify deployment and management of applications in your datacenter.


Derrick Isoka, Program Manager Server App-V