1

I work as a student for a company that sells a proprietary software solution. My task is testing their appliation in APP-V. The client should have the availability to modify a parameter, and this should be changed in the VFS after the package is installed.

Currently, I added following script to the scripts/ section of my V-APP package; This should modify something in LocalSetting.xml in ProgramData\OSG\ShellPlus\Config\

msgbox "test"
replaceWith = WScript.Arguments(0)

Set objShell = CreateObject( "WScript.Shell" )
appDataLocation=objShell.ExpandEnvironmentStrings("%PROGRAMDATA%")
localSettings = appDataLocation & "\OSG\ShellPlus\Config\" & "LocalSetting.xml"

Const ForReading = 1
Const ForWriting = 2

msgbox "test"
x = msgbox(localSettings, 0, "localSettings")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(localSettings, ForReading)

strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "OSG-021\SHELLPLUS", replaceWith)

Set objFile = objFSO.OpenTextFile(localSettings, ForWriting)
objFile.Write strNewText
objFile.Close

I added this to _DeploymentConfig;

    <UserScripts>
  <StartProcess RunInVirtualEnvironment="true">
    <Path>.\Scripts\writeConfig.vbs</Path>
    <Arguments>TEST</Arguments>
    <Wait RollbackOnError="true"/>
    <ApplicationId>[{AppVPackageRoot}]\..\Scripts\writeConfig.vbs</ApplicationId>
  </StartProcess>

Now I tried running the .msi directly, but the script is never executed. Any ideas? I'm out of ideas..

Niels
  • 11
  • 3

3 Answers3

1

It feels like you've jumped a few steps that 'ought' to work, but are missing somethnig somewhere. How are you sure the .MSI is consuming the .XML? Personally I'd experiment with the PoSH commands for adding the package and publishing - at least they'll report errors.

The root cause here is:

  1. that UserScripts cannot be used via the DynamicDeploymentConfiguration. See http://blogs.technet.com/b/appv/archive/2012/12/10/scripting-and-embedded-scripting-for-appv-5-0-dynamic-deployment-and-user-configuration-scripting.aspx

A couple of things appear a little 'off' here:

  1. Also, shouldn't your ApplicationID be an 'application' within the App-V - there's a circular reference here (where the shouldn't be), the ApplicationId should be 'notepad.exe' or whatever.
    Hint: Providing the ScriptEngine may help as well - at least you'll see something happen in procmon after you've published it and tried launching...

  2. Note that having these scripts fire does also have some timing issues, you may need your main shortcut to point to the .VBS and then the .VBS launch the .exe accordingly. Even when you get it going (publishing per-user instead of DynamicDeploymentConfig would do this) - I don't think App-V is going to wait for your .VBS to complete BEFORE launching the real ApplicationId - assuming I've picked up something with point 2.

  • I am no longer working for the company where I needed to do App-V stuff. Thank you for answering, you make some good points. – Niels Jul 22 '15 at 07:41
0

Is scripts enabled in your Client Machine?

If not try running the below Power shell command,

Set-AppvClientConfiguration -EnablePackageScripts $true

  • I think so, [I also used the Dynamic Deployer from here.][1] First I run "Set-AppvClientConfiguration -EnablePackageScripts $true", and then "msiexec /i installer.msi /qn TRANSFORMS=ApplyDeploymentConfig.mst ENABLEPACKAGESCRIPTS=1" in Powershell. Anything else i'm missing? It does take LONG before installation completes. [1]: http://packageology.com/2014/03/applying-dynamic-config-app-v-5-msi-packages/ – Niels Aug 06 '14 at 06:41
  • Update: When installation completes, script is never ran. – Niels Aug 06 '14 at 07:12
-1

We have the same issue in our environment; Scripts are not run from within the package. Our Microsoft Consultant advised us to avoid using the scripting function.

Nina
  • 1