06 Aug / 2014
Author: Sinisa Sokolic Tags: , Comments: 0

Bookmark and Share

If you are running App-V without the complete infrastructure or SCCM you normally have all your packages on a file share.
Attached you find a small script that connects to a given file share, searches for all .appv files in it and loads all the found packages on the target system. If you have connection groups this script also loads these groups afterwards.

The file structure on the file server looks like this:

App-V Packages reside here: \\FILESERVER\Appv
Connection Groups reside here: \\FILESERVER\Appv\AppV_Connection_Groups

You should take care that all of the packages in an Connection Group are available and loaded before loading the respective Connection Groups.

Here is the script. Be sure to save the script and declare the file server name as parameter when starting the script (e.g. load_appv.ps1 FILESERVERNAME):

$Apphub='\\' + $fileserver + '\Appv'

# Import necessary Module vor App-V
Import-Module AppvClient

# Get loaded Connection Groups and remove them first
Get-AppvClientConnectionGroup | Stop-AppvClientConnectionGroup | Remove-AppvClientConnectionGroup | out-file -append $LogFile

# Get loaded packages and remove them
Get-AppvClientPackage | Stop-AppvClientPackage | Remove-AppvClientPackage

# List all files with the suffix .appv
$Result =Get-ChildItem $apphub\*_appv -recurse -Force | Where-Object { $_.Extension -match ”.appv” }

# Add, mount and publish these App-V applications
$Result | ForEach-Object {
Add-AppvClientPackage -Path $_.FullName | Mount-AppvClientPackage | Publish-AppvClientPackage -Global

# Add Connection Groups
# List all files with the suffix .xml and store them in array $CG
$CG =Get-ChildItem $Apphub\AppV_Connection_Groups -recurse -Force | Where-Object { $_.Extension -match ”.xml” }

# Add, mount and publish these App-V Connection Groups
$CG | ForEach-Object {
Add-AppvClientConnectionGroup -Path $_.FullName | Mount-AppvClientConnectionGroup | Enable-AppvClientConnectionGroup -Global

Further information can be found here: