Thursday, January 30, 2014

Install AppV 5.0 Server via silent install

I made a script to automate the creation of our AppV 5.0 Management and Publishing servers.  We are going to install them on the same system.  To do this, we already have a database so we are just adding new servers to the infrastructure.  This script also installs all prerequisites if required.


::================================================================================
::
:: Created by: Trentent Tye
:: Intel Server Team
::
:: Creation Date: Jan 30, 2014
::
:: File Name: RunME_Server.cmd
::
:: Description: This script will configure a AppV 5 server for management
::                      and Streaming Capabilities
::
::================================================================================


@ECHO OFF
pushd %~dp0

CLS


:: ===========================================================================================================
:: Checks for Prerequisites
:: ===========================================================================================================
ECHO Checking for Prerequisites...

:: ===========================================================================================================
:: .NetFramework 4.0
:: ===========================================================================================================
SET DOTNET=1
IF EXIST "C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe" SET DOTNET=0

:: ===========================================================================================================
:: Microsoft Visual C++ 2010 x86
:: ===========================================================================================================
SET MSVC2010x86=1
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\D04BB691875110D32B98EBCF771AA1E1
IF '%ERRORLEVEL%' EQU '0' SET MSVC2010x86=0

:: ===========================================================================================================
:: Microsoft Visual C++ 2010 x64
:: ===========================================================================================================
SET MSVC2010x64=1
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\1926E8D15D0BCE53481466615F760A7F
IF '%ERRORLEVEL%' EQU '0' SET MSVC2010x64=0

:: ===========================================================================================================
:: Web Server + required features
:: ===========================================================================================================
        >FeatureCheck.ps1 ECHO.
        >>FeatureCheck.ps1 ECHO Import-Module servermanager
        >>FeatureCheck.ps1 ECHO get-windowsfeature web-* ^| where-object {$_.Installed -eq $True} ^| out-file $env:temp\windowFeature.txt
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Unrestricted
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" .\FeatureCheck.ps1
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Restricted
        DEL /F /Q FeatureCheck.ps1 >NUL

:: Find Web-Server
SET Web-Server=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Server"
IF '%ERRORLEVEL%' EQU '0' SET Web-Server=0

:: Find Web-Static-Content
SET Web-Static-Content=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Static-Content"
IF '%ERRORLEVEL%' EQU '0' SET Web-Static-Content=0

:: Find Web-Default-Doc
SET Web-Default-Doc=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Default-Doc"
IF '%ERRORLEVEL%' EQU '0' SET Web-Default-Doc=0

:: Find Web-Asp-Net
SET Web-Asp-Net=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Asp-Net"
IF '%ERRORLEVEL%' EQU '0' SET Web-Asp-Net=0

:: Find Web-Net-Ext
SET Web-Net-Ext=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Net-Ext"
IF '%ERRORLEVEL%' EQU '0' SET Web-Net-Ext=0

:: Find Web-ISAPI-Ext
SET Web-ISAPI-Ext=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-ISAPI-Ext"
IF '%ERRORLEVEL%' EQU '0' SET Web-ISAPI-Ext=0

:: Find Web-ISAPI-Filter
SET Web-ISAPI-Filter=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-ISAPI-Filter"
IF '%ERRORLEVEL%' EQU '0' SET Web-ISAPI-Filter=0

:: Find Web-Windows-Auth
SET Web-Windows-Auth=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Windows-Auth"
IF '%ERRORLEVEL%' EQU '0' SET Web-Windows-Auth=0

:: Find Web-Filtering
SET Web-Filtering=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Filtering"
IF '%ERRORLEVEL%' EQU '0' SET Web-Filtering=0

:: Find Web-Filtering
SET Web-Mgmt-Console=1
type %TEMP%\windowFeature.txt | findstr /I /C:"Web-Mgmt-Console"
IF '%ERRORLEVEL%' EQU '0' SET Web-Mgmt-Console=0


:: ===========================================================================================================
:: Windows Management Framework 3.0 (PowerShell 3.0)
:: ===========================================================================================================
        >WMF3.ps1 ECHO.
        >>WMF3.ps1 ECHO $osresult = $null 
        >>WMF3.ps1 ECHO $os = (Get-WmiObject Win32_OperatingSystem).Name 
        >>WMF3.ps1 ECHO if ($os -like "*Windows 8*") {$osresult = "True"} 
        >>WMF3.ps1 ECHO if ($os -like "*Server 2012*") {$osresult = "True"} 
        >>WMF3.ps1 ECHO $hfchk = Get-WmiObject -Query "select HotFixID from Win32_QuickFixEngineering where HotFixID like 'KB2506143'"
        >>WMF3.ps1 ECHO $hfchk.HotFixID ^|out-file $env:temp\WMF3.txt
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Unrestricted
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" .\WMF3.ps1
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Restricted
        DEL /F /Q WMF3.ps1 >NUL

SET WMF3=1
type %TEMP%\WMF3.txt | findstr /I /C:"KB2506143"
IF '%ERRORLEVEL%' EQU '0' SET WMF3=0


:: ===========================================================================================================
:: Install all prerequisites...
:: ===========================================================================================================

ECHO Results...
ECHO DOTNET=%DOTNET%
ECHO MSVC2010x86=%MSVC2010x86%
ECHO MSVC2010x64=%MSVC2010x64%
ECHO Web-Server=%Web-Server%
ECHO Web-Static-Content=%Web-Static-Content%
ECHO Web-Default-Doc=%Web-Default-Doc%
ECHO Web-Asp-Net=%Web-Asp-Net%
ECHO Web-Net-Ext=%Web-Net-Ext%
ECHO Web-ISAPI-Ext=%Web-ISAPI-Ext%
ECHO Web-ISAPI-Filter=%Web-ISAPI-Filter%
ECHO Web-Windows-Auth=%Web-Windows-Auth%
ECHO Web-Filtering=%Web-Filtering%
ECHO Web-Mgmt-Console=%Web-Mgmt-Console%
ECHO WMF3=%WMF3%

ping 127.0.0.1 -n 5 >NUL

IF /I '%DOTNET%' EQU '1' (
ECHO Installing .NetFramework 4.0...
"PreRequisites\dotNetFx40_Full_x86_x64.exe" /Q /norestart
)

IF /I '%MSVC2010x86%' EQU '1' (
ECHO Installing Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)
"PreRequisites\vcredist_x86.exe"  /passive /norestart
)

IF /I '%MSVC2010x64%' EQU '1' (
ECHO Installing Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)
"PreRequisites\vcredist_x64.exe"  /passive /norestart
)

:: ===========================================================================================================
:: Web Server + required features
:: ===========================================================================================================
        >InstallIIS.ps1 ECHO.
        >>InstallIIS.ps1 ECHO Import-Module servermanager

IF /I '%Web-Server%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Server
)
IF /I '%Web-Static-Content%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Static-Content
)
IF /I '%Web-Default-Doc%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Default-Doc
)
IF /I '%Web-Asp-Net%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Asp-Net
)
IF /I '%Web-Net-Ext%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Net-Ext
)
IF /I '%Web-ISAPI-Ext%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-ISAPI-Ext
)
IF /I '%Web-ISAPI-Filter%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-ISAPI-Filter
)
IF /I '%Web-Windows-Auth%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Windows-Auth
)
IF /I '%Web-Filtering%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Filtering
)
IF /I '%Web-Mgmt-Console%' EQU '1' (
        >>InstallIIS.ps1 ECHO Add-WindowsFeature Web-Mgmt-Console
)

ECHO Installing Web Server and required features...
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Unrestricted
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" .\InstallIIS.ps1
        "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Restricted
        DEL /F /Q InstallIIS.ps1 >NUL

ECHO Installing Windows Management Framework 3.0...
IF /I '%WMF3%' EQU '1' (
c:\windows\system32\wusa.exe "PreRequisites\Windows6.1-KB2506143-x64.msu" /quiet /norestart
)

ECHO Installing Silverlight x64...
"PreRequisites\Silverlight_x64.exe" /q /doNotRequireDRMPrompt /ignorewarnings

ECHO Prepping AppV Server install post-reboot...
ECHO.
ECHO You may have to login to this server with a local admin account
ECHO to execute the install...

cd /d "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
        >startup.cmd ECHO @ECHO OFF
        >>startup.cmd ECHO c:\windows\microsoft.net\framework\v4.0.30319\aspnet_regiis.exe -ir
        >>startup.cmd ECHO c:\windows\microsoft.net\framework64\v4.0.30319\aspnet_regiis.exe -ir
        >>startup.cmd ECHO net use Z: "\\FILESERVER\ctx_images_bdc\_ISO\AppV\App-V for RDS v5.0 SP1\APP-V 5.0 SERVER SP1"
        >>startup.cmd ECHO Z:
        >>startup.cmd ECHO ECHO Installing Management Server...
        >>startup.cmd ECHO APPV_SERVER_SETUP.EXE /QUIET  /AcceptEULA /MANAGEMENT_SERVER /MANAGEMENT_ADMINACCOUNT="DOMAIN\APV.Admins" /MANAGEMENT_WEBSITE_NAME="Microsoft App-V Management Service" /MANAGEMENT_WEBSITE_PORT="12345" /EXISTING_MANAGEMENT_DB_REMOTE_SQL_SERVER_NAME="WSSQL" /EXISTING_MANAGEMENT_DB_CUSTOM_SQLINSTANCE="PRDINST01" /EXISTING_MANAGEMENT_DB_NAME="APPV5DB"
        >>startup.cmd ECHO ECHO Installing Publishing Server...
        >>startup.cmd ECHO APPV_SERVER_SETUP.EXE /QUIET /AcceptEULA /PUBLISHING_SERVER /PUBLISHING_MGT_SERVER="http://%COMPUTERNAME%.%USERDNSDOMAIN%:12345" /PUBLISHING_WEBSITE_NAME="Microsoft App-V Publishing Service" /PUBLISHING_WEBSITE_PORT="55555"
        >>startup.cmd ECHO cd /d "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
        >>startup.cmd ECHO START shutdown.exe -r -t 60 -f
        >>startup.cmd ECHO DEL /F /Q startup.cmd

ECHO Rebooting...
shutdown -r -t 60 -f

Tuesday, December 17, 2013

Slow PowerShell CSV reading and object generation

I am attempting to read a CSV file and decided the best way to do it was with PowerShell's native import-csv tool.  What was required was to read this CSV and then generate a registry file for import into numerous computers.  This was my result:

########################################################################################
#
#  Created by Trentent Tye
#             IBM Intel Server Team
#             December 13, 2013
#
# Description: This script will take a CSV file that contains values that are flexible
# and maintained by the MetaVision team and create a .reg file and import that file
# into the computer it's run on.
#########################################################################################

Get-Date
$csv = Import-csv .\MetaVision.csv

$output = "Windows Registry Editor Version 5.00`n`n"

$date = get-date
write-host first run $date
Foreach ($server in $csv.Server) { 
$regObject = $csv | Where {$_.server -eq $Server}
$output += "[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\iMD Soft\Citrix Clients\$server\Database Connect]`n"
$output += """Default Offline Mode""=""0""`n"
$output += """Default  Offline Mode""=""0""`n"
$output += """Domain Department""=""{0}""`n" -f $regObject.'Domain Department'
$output += """Default Department""=""{0}""`n" -f $regObject.'Default Department'
$output += """EMPI Database""=""{0}""`n" -f $regObject.'EMPI Database'
$output += """EMPI Server""=""{0}""`n" -f $regObject.'EMPI Server'
$output += """Offline Mode""=""0""`n"
$output += """Production Database""=""{0}""`n" -f $regObject.'Production Database'
$output += """Production Server""=""{0}""`n`n" -f $regObject.'Production Server'
$output += "[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\iMD Soft\Citrix Clients\$server\Settings]`n"
$output += """Application Size""=""1""`n"
$output += """Customize Units""=""0""`n"
$output += """DebugMode""=""0""`n"
$output += """DisplayLocalizationID""=""0""`n"
$output += """LastLogin""=""null""`n"
$output += """LocaleID""=""1033""`n"
$output += """LogFileMode""=""1""`n"
$output += """LogFilePath""=""""`n"
$output += """LoginPolicyMode""=""{0}""`n" -f $regObject.'LoginPolicyMode'
$output += """ProximityLockRange""=""0""`n"
$output += """ProximityObject""=""""`n"
$output += """ProximityUnlockRange""=""0""`n"
$output += """Silent""=""1""`n"
$output += """UseMRDDriver""=""0""`n"
$output += """UseVirtualKeyboard""=""0""`n"
$output += """Workstation BedID""=""{0}""`n" -f $regObject.'Workstation BedID'
$output += """Workstation LayoutID""=""""`n"
$output += """Workstation Type""=""{0}""`n" -f $regObject.'Workstation Type'
$output += """WriteActionsToLog""=""0""`n`n"
}

$date2 = get-date
$totaltime = ($date2 - $date).TotalSeconds / 60
write-host first complete $totaltime


rm "$env:temp\MetaReg.reg"
write-output $output | out-file -FilePath "$env:temp\MetaReg.reg"
Get-Date
write-host "Importing registry"
regedit /s "$env:temp\MetaReg.reg"
Get-Date

The CSV file we have has about 1500 lines in it.  To generate the registry key utilizing this method took 6 minutes and 45 seconds.  This is unacceptably slow.  I then started googling ways to speed up this processing and came across this article:
http://stackoverflow.com/questions/6386793/how-to-use-powershell-to-reorder-csv-columns

Where Roman Kuzmin suggested to handle the file as a text file instead of a PowerShell object.  The syntax used to generate convert the file into objects that can replace text as needed is a bit different but I decided to explore it.  His example code is as follows:


$reader = [System.IO.File]::OpenText('data1.csv')
$writer = New-Object System.IO.StreamWriter 'data2.csv'
for(;;) {
    $line = $reader.ReadLine()
    if ($null -eq $line) {
        break
    }
    $data = $line.Split(";")
    $writer.WriteLine('{0};{1};{2}', $data[0], $data[2], $data[1])
}
$reader.Close()
$writer.Close()
 
Essentially, he is proposing reading the file line by line and extracting the data by manually splitting the text string.  The string then turns into an array that you can use for substitution.  This is my final code using his example:

########################################################################################
#
#  Created by Trentent Tye
#             IBM Intel Server Team
#             December 13, 2013
#
# Description: This script will take a CSV file that contains values that are flexible
# and maintained by the MetaVision team and create a .reg file and import that file
# into the computer it's run on.
#########################################################################################


$date = get-date
write-host first run $date
if (test-Path $env:temp\MetaReg.reg) {rm "$env:temp\MetaReg.reg"}


$reader = [System.IO.File]::OpenText('MetaVision.csv')
$reader.ReadLine() # skip first line
$writer = New-Object System.IO.StreamWriter "$env:temp\MetaReg.reg"
$writer.WriteLine("Windows Registry Editor Version 5.00")
$writer.WriteLine("")

for(;;) {
    $line = $reader.ReadLine()
    if ($null -eq $line) {
        break
    }
    $data = $line.Split(",")
    $writer.WriteLine("[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\iMD Soft\Citrix Clients\{0}\Database Connect]`n", $data[0])
    $writer.WriteLine("""Default Offline Mode""=""0""`n")
    $writer.WriteLine("""Default  Offline Mode""=""0""`n")
    $writer.WriteLine("""Domain Department""=""{0}""`n", $data[2])
    $writer.WriteLine("""Default Department""=""{0}""`n", $data[1])
    $writer.WriteLine("""EMPI Database""=""{0}""`n", $data[3])
    $writer.WriteLine("""EMPI Server""=""{0}""`n", $data[4])
    $writer.WriteLine("""Offline Mode""=""0""`n")
    $writer.WriteLine("""Production Database""=""{0}""`n", $data[5])
    $writer.WriteLine("""Production Server""=""{0}""`n`n", $data[6])
    $writer.WriteLine("")
    $writer.WriteLine("[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\iMD Soft\Citrix Clients\{0}\Settings]`n", $data[0])
    $writer.WriteLine("""Application Size""=""1""`n")
    $writer.WriteLine("""Customize Units""=""0""`n")
    $writer.WriteLine("""DebugMode""=""0""`n")
    $writer.WriteLine("""DisplayLocalizationID""=""0""`n")
    $writer.WriteLine("""LastLogin""=""null""`n")
    $writer.WriteLine("""LocaleID""=""1033""`n")
    $writer.WriteLine("""LogFileMode""=""1""`n")
    $writer.WriteLine("""LogFilePath""=""""`n")
    $writer.WriteLine("""LoginPolicyMode""=""{0}""`n", $data[8])
    $writer.WriteLine("""ProximityLockRange""=""0""`n")
    $writer.WriteLine("""ProximityObject""=""""`n")
    $writer.WriteLine("""ProximityUnlockRange""=""0""`n")
    $writer.WriteLine("""Silent""=""1""`n")
    $writer.WriteLine("""UseMRDDriver""=""0""`n")
    $writer.WriteLine("""UseVirtualKeyboard""=""0""`n")
    $writer.WriteLine("""Workstation BedID""=""{0}""`n", $data[9])
    $writer.WriteLine("""Workstation LayoutID""=""""`n")
    $writer.WriteLine("""Workstation Type""=""{0}""`n", $data[10])
    $writer.WriteLine("""WriteActionsToLog""=""0""`n`n")
    $writer.WriteLine("")
}
$reader.Close()
$writer.Close()



$date2 = get-date
$totaltime = ($date2 - $date).TotalSeconds / 60
write-host first complete $totaltime



write-host "Importing registry"
regedit /s "$env:temp\MetaReg.reg"
Get-Date

The total time for this?  0.07 seconds.  Incredibly fast.  So, utilize the Import-CSV command and object based creation with caution.  Utilizing even a moderately sized file will take an unacceptable amount of time.

Wednesday, November 20, 2013

Microsoft and Citrix putting pictures of scripts in documents...

Come on guys, a little more effort than that.  How are you supposed to copy paste an image?

The script is the following:

It's supposed to pull the application and command-line to execute it in AppV5.  I got the script from this document:
http://www.microsoft.com/en-us/download/details.aspx?id=40885


"PackageName,Application Name,ApplicationPath"|out-file .\appPath.txt -Append
foreach($pkg in (gwmi -Namespace root\AppV -Class AppVClientPackage -Filter "IsPublishedGlobally = true"))
{

    $apps=gwmi -Namespace root\AppV -Class AppVClientApplication -Filter "PackageID = '$($pkg.PackageId)' and PackageVersionID = '$($pkg.VersionId)'"

   foreach($app in $apps)

   {

      $rootfolder=(Get-ItemProperty "HKLM:\Software\Microsoft\AppV\Client\Packages\$($app.PackageID)\Versions\$($app.PackageVersionID)\Catalog").Folder

      $appPath=$app.TargetPath.Replace("[{AppVPackageRoot}]",$rootFolder)

      "$($pkg.Name),$($app.Name),$($appPath)"|out-file .\AppPath.txt -Append
   }
}

Friday, November 15, 2013

Error launching batch file from within AppV 5 bubble

So we have an application that requires the "%CLIENTNAME%" variable to be passed to it in it's exe string.  The string looks like so:
prowin32.exe -p \\nas\cfgstart.p -param S,%CLIENTNAME%,120n,citrix,a92,10920 -wy

The issue we have is APPV does not seem to get that variable and pass it to the program.  So when the program starts, it makes %clientname% folders in a temp directory and we can't have two %clientname% folders in the same directory so only one instance of the application can be launched *period* if we do it this way, as opposed to one per server.

To resolve this issue I wrote a script that will pass the %CLIENTNAME% variable to AppV by ripping it out of the registry:

=======================================================
ECHO Launching Centricity...

for /f "tokens=1-3" %%A IN ('reg query "HKCU\volatile environment" /s ^| findstr /i /c:"CLIENTNAME"') DO SET CLIENTNAME=%%C

prowin32.exe -p \\nas\cfgstart.p -param S,%CLIENTNAME%,120n,citrix,a92,10920 -wy
=======================================================

This worked for AppV 4.6 without issue.  Now with AppV 5 I get an error, PATH NOT FOUND when trying to launch this script.


To verify the path exists in the app I ran the following commands:


The powershell commands put me in the AppV 5 bubble then opened a command prompt.  From the command prompt I can see the directory that is missing.  Going back to procmon I was curious to see what command it was launching.  It was launching this:

cmd /c ""C:\ProgramData\Microsoft\AppV\Client\Integration\3230251A-5B8E-47EF-8378-986B2A492D05\Root\VFS\Common Desktop\MyApps\BDM Pharmacy v9.2\Centricity Pharmacy Test on rxpv91cal.cmd" /appvve:3230251A-5B8E-47EF-8378-986B2A492D05_03CA3F94-F318-4693-A7E3-038DB30E6C70"

This command was failing.  It appears that when you are launching the .cmd file directly AppV 5 starts the cmd.exe *outside* the AppV bubble and it doesn't connect to the appvve.  To correct this I tried this command line:

cmd /c "cmd.exe /c "C:\ProgramData\Microsoft\AppV\Client\Integration\3230251A-5B8E-47EF-8378-986B2A492D05\Root\VFS\Common Desktop\MyApps\BDM Pharmacy v9.2\Centricity Pharmacy Test on rxpv91cal.cmd" /appvve:3230251A-5B8E-47EF-8378-986B2A492D05_03CA3F94-F318-4693-A7E3-038DB30E6C70"

Success!  It launched successfully and saw the directory and everything was good there after.  So let that be a lesson to other AppV 5 package makers, if you need a pre-launch script you may need to modify your published icon to put another cmd.exe /c before the command file for it to start in the bubble.

A very good AppV blog has already discovered this issue and came back with a better fix than mine:
http://blogs.technet.com/b/virtualvibes/archive/2013/10/17/the-issues-of-sequencing-bat-shortcuts-in-app-v-5-0.aspx

Wednesday, October 23, 2013

Citrix Provisioning Services (PVS) update failure

I recently got Event ID 0 on Citrix vDisk Update Service; "Update Task (UpdateTask) is not loaded"



The fix is to restart the Soap service on your chosen automatic update PVS server.