At the moment I am working in an environment where App-V is integrated in SCCM 2007. To launch an App-V application the “Vapplauncher” is used. This week I have been asked to package an application with the following requirements.
The application must be able to start from a Scheduled Task and External Application.
- The application must start with different parameters.
- The parameters can change every month and this should be done by the “Super user” (Which has no access to App-V / SCCM)
Starting the App-V application from a schedule or external application is just pasting the Vapplauncher command line into it. However, the Vapplauncher doesn’t accept any parameters. This is why you have to create a extra OSD with the parameters in it. This means that the “Super user” has to change this OSD each month and deploy it through SCCM. Of course this was not an option because of the rights.
- Start the application with the parameters through: C:\WINDOWS\system32\CCM\VAppLauncher.exe /launch “MyApp”
- The user must be able to change the parameters each month without having to change the OSD or having special rights.
- Create a networkshare where the user has enough rights to change/write files
- Place a *.txt file in the share containing the parameters
- Create a PowerShell script (or more if needed) in the share which can do the following:
- Get the content of the *.txt file
- Start the application with the parameters found in the *.txt file which is edited by the user
- Create an OSD to start the PowerShell script
- Give the user the command line to start the OSD so it can be used in a schedule or External application
Components of the solution:
*.txt file for user: G:\MyApp\Test\MyApp_parameters.txt
PowerShell script: G:\Myapp\test\Script\Start_Myapp.ps1
App-V package: With at least one OSD that starts the application with the powershell script
The powershell script:
#Filing some Variables
$ParametersTXT=Get-Content "G:\MyApp\Test\MyApp_parameters.txt "
#Some arguments are fixed this will be combined with the Parameters from the TXT file
$StartMyAppArguments +="/DSN=Test /CMD=ABC "
$StartMyAppArguments +="/TXT=" + $ParametersTXT
#Start the application with arguments
&$StartPath -p $StartMyAppArguments
These are the basics of the script. Of course you should adept it to your needs with logging and checking on existing files etc. But now you will have a start.
This is the starting line you should use in the OSD:
parameters="-file G:\Myapp\test\Script\Start_Myapp.ps1" FILENAME="%CSIDL_SYSTEM%\WindowsPowerShell\v1.0\powershell.exe"
The command line to start the application is:
C:\WINDOWS\system32\CCM\VAppLauncher.exe /launch " MyApp-StartbySchedule”
Thank you for reading. I hope it will be useful for you. If you have any comments or questions you can use the comments underneath or the PM system to ask questions.