The way you deploy scripts on App-V 5.0 changed a lot in front of App-V 4.6. I tried a lot to get scripts working. This howto is maybe not the best solution but for me it works now well. So let’s beginn.
First of all you need a file share where you can place your scripts. For example:
Attention: On this share “Everybody” must have read rights!
In our example i have a program that should copy some files to the Windows folder. So i created a folder with the software name (in my case “Celcat”) and put in the files i want to copy.
In the SysWOW64 folder are my files which i want to copy. The other file “celcat.ps1” is the script. This is our script. Here is the content of my celcat.ps1 script:
Copy-Item '\\app-v.yourdomain.at\scripts$\Celcat\SysWOW64\*' 'C:\Windows\SysWOW64\' -Recurse -Force
After that you can login to your Admin Console through the Web Browser. Then select your Application and with right click select: “edit default configuration“. Then click on “(4) Advanced” and then “Export configuration“. Now you can save the .xml file on your computer.
I highly recommend to use an XML Editor. We must add now our script. These are the lines we must add:
<Arguments>-ExecutionPolicy ByPass -File \\app-v.yourdomain.at\scripts$\Celcat\celcat.ps1</Arguments><Wait Timeout="120" RollbackOnError="true"></Wait>
The full .xml file you can find here.
For the Server side we are now finished. Now we can configure our Client to run the script. We must enable scripts on the client with following command:
Set-AppvClientConfiguration -EnablePackageScripts $true
After that we can run the Publishing Command:
Publish-AppvClientPackage -Name * -Global
Now the script should run and you can look in your Windows folder if the files are now present. You can see the result of the script status in the Event Viewer.
You can add the option to publishing all applications on login, when you add a App-V Publishing Server. Use this command:
Add-AppvPublishingServer -Name app-v.yourdomain.at -URL http://app-v.yourdomain.at:12346 -GlobalRefreshEnabled $true -GlobalRefreshOnLogon $true