Udostępnij za pośrednictwem


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:

Module name: ServerAppVAgent

  1. Get-ServerAppVAgent 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.
  2. Get-ServerAppVPackage 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.
  3. Add-ServerAppVPackage 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.
  4. Set-ServerAppVPackage 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.
  5. Start-ServerAppVPackage 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.
  6. Stop-ServerAppVPackage 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.
  7. Remove-ServerAppVPackage cmdlet basically does what the name implies. It removes the package and all of the registration associated with the package from your machine.
  8. Backup-ServerAppVPackageState 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.
  9. Restore-ServerAppVPackageState 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.
  10. Remove-ServerAppVPackageState 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