How to Manage Virtual Applications Using the Server App-V Agent Cmdlets
Microsoft System Center Virtual Machine Manager (SCVMM) 2012 has everything you need to manage your Server App-V packages. You can add Server App-V packages to the VMM library, create application profiles, and deploy packages to your VMs by using SCVMM’s user interface. SCVMM is perfect for your production environments. However, you may want to use something else to quickly test your sequenced packages in your test environments. To make your development and test scenarios easy, Server App-V gives you a set of PowerShell cmdlets. By using these cmdlets, you can do any kind of package management operation in your dev/test environments. Here is a list of PowerShell cmdlets and what they are for:
- Get-AppVAgent cmdlet gives you information about the machine that’s running Server App-V. It lists information such as the Server App-V version on the machine and the logging level of Server App-V.
- Get-AppVPackage cmdlet gives you information about Server App-V packages added to the system. It lists information such as package name, package version and size of the package.
- Add-AppVPackage cmdlet is my favorite cmdlet as it demonstrates how a deployment scenario can be as simple as running a single command. This cmdlet takes your SFT file path, package manifest file path and a package name as parameter and adds the Server App-V package to the system. Depending on your package size, this operation may take a while. You can also specify deployment configuration file as an optional parameter to the Add-AppVPackage cmdlet.
- Set-AppVPackage cmdlet applies a deployment configuration document to the specified package. Basically, you can change settings of your Server App-V package by using deployment configuration items. This cmdlet is intended to run after Add-AppVPackage cmdlet to configure your package, if you didn’t pass a deployment configuration file into the Add-AppVPackage cmdlet.
- Start-AppVPackage cmdlet starts your Server App-V package. “Start” means that all Windows Services, IIS sites and other applicable processes of your package that would normally start at system startup will be started by Server App-V Agent. This cmdlet takes the package name as input parameter and is intended to run after Add-AppVPackage and Set-AppVPackage cmdlets.
- Stop-AppVPackage cmdlet is the reverse of Start-App-VPackage. It will stop all the processes belong to your package. This cmdlet takes the package name as input parameter.
- Remove-AppVPackage cmdlet basically does what the name implies. It removes the package and all of the registration associated with the package from your machine.
- Backup-AppVPackageState cmdlet backs up your package state*. As an example, this cmdlet is useful when you want to replace a machine that has a Server App-V package running on it. You can do a backup state operation on the machine and restore the state on your new machine so you don’t lose any data.
- Restore-AppVPackageState cmdlets uses the output from Backup-AppVPackageState and restores the generated state. The Backup-AppVPackageState and Restore-AppVPackageState cmdlet pair is useful when you want to move a package to a different machine.
- Remove-AppVPackageState cmdlet removes the associated state from the package. After running this cmdlet, your package will return back to its original condition. This is equivalent to running Remove-AppVPackage and Add-AppVPackage cmdlets.
*State: In the above cmdlet descriptions you heard ‘state’ a lot. So what’s it all about? State is basically the configuration changes and data that are accumulated as your virtual applications run. When you first add your Server App-V package to the system, it has no state. As the applications run and configured, something changes in the package. For example, any registry value, any changes to the existing file content, any new files added become part of the package state. Capturing state information is very important in package move scenarios because without this ability you would lose data when you move your package to a different machine. Server App-V gives you the ability to capture the state and move your package to a different machine by restoring the captured state in the new machine. SCVMM also uses Backup-AppVPackageState and Restore-AppVPackageState cmdlets behind the scenes to manage your packages in the VMM environment.
With this blog post we make an introduction to Server App-V Agent Cmdlets. In the next blog posts, our plan is to explain each cmdlet in detail by giving examples specific to each cmdlet. Stay tuned!
Emre Kanlikilicer – SDEII - Microsoft Server Application Virtualization