As a follow up to Emre’s article on how to create packages using the Server App-V Sequencer, we are providing step by step instructions on how to sequence and deploy PetShop 4. This is especially useful if you are new to the whole concept of virtualization and specifically Server App-V and we hope you find this useful in understand the sequencing and deployment process using Server App-V.

This blog article provides a great reference for installing the Sequencer if it is not already installed: http://blogs.technet.com/b/scvmm/archive/2011/04/18/creating-virtual-application-packages-with-microsoft-server-application-virtualization-sequencer.aspx . The IIS role and the IIS Management tools must be enabled, Sequencer run-time prerequisites, and MS Deploy (http://www.iis.net/download/WebDeploy) should be installed, as well.

Environment:

Ensure you have the Server App-V Sequencer installed on a Windows Server 2008 R2 Virtual Machine.

Tasks

The Petshop 4 Installers are available from http://msdn.microsoft.com/en-us/library/aa479071.aspx(same installer for x32 and x64 as well).


image Critical:

If this is a new installation of the Sequencer, create a Snapshot to save the VM in a pristine state with just the Sequencer, web deploy and IIS role installed. If this VM has been used for sequencing previously, revert to Snapshot of the machine with just the Sequencer and IIS role installed.

1. Copy the Petshop 4 installation files to the Sequencing VM.

2. PetShop requires User Account Control (UAC) to be off. Turn off UAC and restart the machine before starting sequencing.

a. Click on CONTROL PANEL > SYSTEM AND SECURITY

b. Under "Action Center", click on "Change User Account Control Settings"

image

c. Move the slider to "Never Notify" and click OK.

d. Click YES on the security dialog.

e. Restart the machine.

3. Launch the Microsoft Application Virtualization Sequencer from START > MICROSOFT APPLICATION VIRTUALIZATION > MICROSOFT APPLICATION VIRTUALIZATION SEQUENCER. Instructions on installing the Server App-V Sequencer are here.

4. Select "Create a New Virtual Application Package"

image

5. Address any issues highlighted in the "Prepare Computer" phase.

a. Double-clicking a message will provide more details as well as a suggested resolution.

6. Click Next.

7. On the "Select Installer" screen, browse to the location of the Pet Shop installer, "Microsoft .NET Pet Shop 4.0.msi" and click OPEN.

image

8. Click Next

9. On the "Package Name" screen, type "Petshop 4" in the "Virtual Application Package Name" field.

a. This also creates a "Petshop 4" folder on the Q drive automatically.

image

10. Click Next.

11. The installation will start after a few moments.

12. Click RUN on the Security Warning that pops up.

13. The Setup Wizard for Pet Shop appears. Click Next.

image

14. Select "I agree" for the EULA and click Next.

15. Review the information for Pet Shop requirements and click Next.

16. Choose "Source Code Only" on the Installation Options screen and click Next. This option is selected with the assumption that existing databases, created later by a script will be used.

image

17. Change the installation folder to "Q:\Petshop 4" and click Next.

image

18. Click Next on the "Confirm Installation" screen.

19. Close the Internet Explorer page that opens when installation completes.

20. Click "Close" on the "Installation Complete" screen.

21. Minimize the Sequencer


image Do Not:

Do not click on "I am finished installing." Monitoring is still occurring in this phase and additional actions are required.

22. Open an elevated Command Prompt

23. Change to "Q:\Petshop 4"

24. Type "build.bat"

a. Wait for all the actions to complete. "Press any key to continue…" will appear when the batch is finished.

25. From the same elevated Command Prompt session, run "DecryptWebConfig.bat"

a. "Press any key to continue…" will appear when the batch is complete.

26. In IIS manager, create a web site “Petshop4”

a. Click on Start>Administrative Tools>Internet Information Services (IIS) Manager.

b. Right-Click on "Sites" and select "Add Web Site…"

c. Name the site "Petshop4"

d. Point the Physical Path to "Q:\Petshop 4\web"

e. Set the port to 8080, or whichever port you want to use in your environment.

image  

f. Click OK.

27. From an Explorer window, copy the "Q:\DatabaseScripts" folder to a network share.

a. These scripts are useful for creating the database if it does not already exist.

28. Maximize the Sequencer.

29. Check "I am finished installing" and click Next.

30. On the Configure Software screen, click Next.

a. No First Use tasks need to be managed for PetShop4.

31. On the Completion screen you may receive information on additional actions before saving the package.

image

32. Deployment configuration entries should be captured at the end of sequencing with all connection strings and app settings.
image

33. Save the Package

34. Close the Sequencer

35. Copy the completed package to a server in a Development Environment to test.

Deploying PetShop 4 to a Development Environment with PowerShell 2.0

In a Production Environment, SCVMM 2012 is the sole method for deploying Server App-V Applications. For a Test Environment, PowerShell commands are used to deploy Server App-V Applications.

image More Information:

For more information about deploying PetShop 4 with SCVMM 2012, see:

http://blogs.technet.com/b/m2/archive/2011/03/29/how-to-deploy-the-pet-shop-application-as-a-service-in-vmm.aspx . This article is also available as a Word document at the bottom of the posting.

image Important:

For the purposes of this document, the SQL Server installation is on the same server as the SAV Agent. This is not required. The SQL Server can be remote.

Pre-requisites
  • Windows Server 2008 R2 Virtual Machine
  • SQL Server 2008 installation
  • IIS Server Role installed
    • IIS Management tools
  • PowerShell 2.0
  • Local Administrator privileges
  • MS Deploy (Web Deploy 2.0)
  • Note:
    • A best practice is to ensure that the sequencing machine and deployment machine are as identical as possible
    • The manifest file will also have a list of the Windows Roles and Features captured on the sequencing workstation that were turned on prior to sequencing
Configuring SQL

1. Copy the PetShop 4 Database scripts created during sequencing from their network share to the Virtual Machine containing SQL.

2. From an elevated Command Prompt, run the "InstallDatabases.cmd". This will correctly setup the databases required for PetShop 4.

3. Four databases should be created in SQL: MSPetShop4, MSPetShop4Orders, MSPetShop4Profile, and MSPetShop4Services.

image

4. In the "SQL Server Management Studio", right-click the hostname. Select Properties.

5. Under Security, change the Server Authentication to "SQL Server and Windows Authentication Mode".

image

6. Click OK

7. The SQL Server may need to be restarted.

8. Right-Click on the Server hostname and select "Restart".

image Important:

The "deploymentconfig.xml" file needs the correct password information. Search for "XML Notepad" on Bing for download information and use it for editing the XML file.

Installing the PowerShell Cmdlets

1. Browse to the "Cmdlets" folder in the SAV installation media.

a. …\x64\cmdlets\en-us for the US English version. Use the version most appropriate for your environment.

2. Double-click on "sav_cmdlets."

3. Accept the EULA and click "Install"

4. Accept the User Account Control (UAC) notification if one pops up by clicking "Yes."

5. Click OK on the notification that the installation was successful.

Installing the SAV Agent

1. Browse to the "x64" folder in the SAV installation media.

2. Double-click on "AgentSetup.exe" to begin installation.

3. Click "Yes" on UAC notification.

4. Click "Next" to begin the wizard.

5. Accept the EULA and click "Next."

6. Choose whether or not to opt-in for Microsoft Update and click "Next."

7. Install to the default path and click "Next."

8. The "Ready to Install" screen displays what will be installed. If they pre-requisite runtimes are not already installed, they will be included in the installation of the SAV Agent.

image

9. Click "Next".

10. After installation completes, click "Finish" to exit.

Editing the Deploymentconfig.xml file

The current "deploymentconfig.xml" for PetShop4 is missing password information for the databases created with the "InstallDatabases.cmd". The "Server" information may need to be changed, as well, if your SQL server is not local to the same machine as the deployment. Use a tool like XML Notepad 2007 to edit the XML without accidentally malforming the information. Change the server and password information needs in the SQLConnStrings.

1. In Explorer, copy the "deploymentconfig.xml" file, paste, and rename the file to "deploymentconfig-modified.xml".

2. In XML Notepad, Click CTRL+H to open Replace

a. Search for "password=" and replace with " password=pass@word1"

image

b. Click "Replace" NOT "Replace All"

c. Click "Find Next" until all instances of "password=" also have "pass@word1" associated.

3. Save "deploymentconfig-modified.xml"

Deployment Using Powershell

1. Run PowerShell as an Administrator.

image

2. Click "Yes" on the UAC warning to accept.

3. Verify the version of PowerShell by typing:

$host.version

a. The result should be:

image

4. Set the Execution Policy:

Set-ExecutionPolicy remotesigned

5. Select "Y" to allow the execution policy change.

6. Import the SAV Cmdlets module. This will have to be done on each usage of the SAV Cmdlets. This behavior does not persist.

Import-Module ServerAppVAgent

image Tip:

Verify the SAV Agent is installed by typing "Get-ServerAppVAgent"

7. The order of the parameters used for adding an application is always the same. If the parameters are not specifically called out, this order matters. When parameters are specified, the order does not matter. As a best practice, follow this order:

a. Name

b. Manifest

c. SFT

d. Configuration

8. To add the application package (assumed to be in C:\packages\petshop4 for this document) type the following in PowerShell:

Add-ServerAppVPackage Petshop -manifest C:\packages\petshop4\petshop4_manifest.xml -sft c:\packages\petshop4\petshop4.sft -configuration c:\packages\petshop4\deploymentconfig-modified.xml

9. The following message will be displayed:

image

10. After the package is successfully added the package info will be displayed:

image

11. Open Internet Explorer

12. In the address bar, type http://localhost:8080

13. PetShop runs successfully:

image

Steve Bucci, SUPPORT ESCALATION ENGINEER