App-V 5.0 – Management Server Automation – SMB Streaming
Hi all,
As part of the 4.5 Management server we had no way of automatically adding packages to the management server and publishing them to client. One of the key improvements in the App-V 5.0 Management Server is the ability to automatically add and publish packages.
As part of the App-V 5.0 beta 2 release it offers a brand new Powershell module which allows full control over the Management Server. You may be wondering how do we get information about what commands are available?
Get-Command -Module AppVServer
The following is returned from the command.
First things first as part of App-V 5.0 beta 2 we support SMB, HTTP and HTTPS streaming of packages, RTSP streaming is no longer available.
SMB Streaming Configuration
In this scenario we’re going to setup and configure all packages for SMB streaming from a share we’ve already setup.
Using Powershell we need to define the share location which holds all the App-V 5.0 packages.
$AppVContent = \\appv5mgmt\content\
The directory has been defined, now we need to get all the files and folders from that directory, the recurse switch is used to enumerate all sub-directories. The final part of the command is using the where command which is used to search for only “*.appv” packages.
$pkg = gci $AppVContent -Recurse | where { $_.name -Like "*.appv" }
Notice we put the command in a variable, why did we do this? A variable is used so that we can reuse the contents, you can see from the Powershell console above each directory is listed which holds an “.appv” package.
Before we import our packages we want to show exactly what we’re doing with Powershell. This command is looping through the $pkg variable and for each entry outputting the FullName, this is the full directory path plus the name of the “.appv” package. We’re going to be using this output when we import the package.
$pkg | ForEach-Object { $_.FullName }
Before we run the script let’s have a look at our packages section of the management server, you can see there are no packages present.
Let’s go ahead and import some packages automatically. It’s the same command that we ran before but we have added “Import-AppvServerPackage” cmdlet from the AppvServer module.
Import-AppvServerPackage |
This cmdlet accepts a file path to a valid APPV package. The specified package is then imported into the App-V Management server and an object to the package is returned. |
Example: Test-AppvLegacyPackage –SourcePath c:\packages\4.6\7Zip915.001 |
$pkg | ForEach-Object { Import-AppvServerPackage $_.FullName }
Once the command has been ran the packages section has been updated, but you may have noticed none of the packages have been published.
Before we can publish our package we need to set which AD security group have access to the packages as shown below.
To do this, we have created a security group in AD called “AppV_Users”. Within this group are the users who have access to all App-V packages.
The first command is setting a variable $Group with the group created in AD.
$Group = "APPV5\AppV_Users"
Once we have that group we’re going to get all packages using cmdlet “Get-AppvServerPackage” and then use “Grant-AppvServerPackage” to set all packages just added with AD Access as the AppV_Users Group.
Get-AppvServerPackage | Grant-AppvServerPackage -Groups $Group
Now the AD Access section has been updated with the AD Group specified above.
Now the final piece of the puzzle is to publish all packages. To do this we’re going to use a command we have used before “Get-AppvServerPackage”. Firstly we’re going to loop through all the packages then publish them all.
Get-AppvServerPackage | Publish-AppvServerPackage
Now if we load the Management console and select the Packages section you can see all the packages have been published.
Finally just to show that SMB streaming has been setup we’re going to open the publishing server website which displays the streaming location of our packages.
Finally you can use the Powershell pipe command | to join multiple commands together, so instead of using single commands we can complete a grant and publish-appvServerPackage in a single command.
Get-AppvServerPackage | Grant-AppvServerPackage -Groups $Group | Publish-AppvServerPackage
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
Using Powershell to automatically add packages to the Management server is an easy process if you get the commands and switches correct. Another article on how to configure HTTP streaming will be available in the next day or so.
David Falkus | Premier Field Engineer | Application Virtualization
Comments
- Anonymous
September 26, 2013
Hi There, We are currently in the process of setting up an App-V environment and things like this are of great interest to me. I am looking to try and find out performance best fits for my environment and this brings another option to the plate. Do you know if there are any benefits of using SMB streaming rather than HTTP streaming in a RDS environment? Thanks