How to use “On startup scripts” in your APP-V package, showed by using our “Phillips IntelliSpace” package

There's so many creative ways to make sure your Sequenced App-V applications always have a perfect launch when it starts up. This can often be done by loading the correct config data, and without having to do manual configurations and so avoiding error messages.


Most of the time this can be put in the registry or a config file for the package, or scripted into the machine during the add or publishing phase with a run once event script.

But sometimes this will not work, maybe because another process has to be started first, maybe because the application have a poorly designed license registration. We may first need to check if other processes are stopped or running fine before the virtual application starts up and can be licensed.

One way is to create an “On process start” script for your applications .EXE file(s), this will be started before your main executable file is started.

First thing you do in the Sequencer, check your “Shortcuts and FTAs” tab.

If you don’t see the correct .EXE file there I don’t know if you can do this any other way in the Sequencer then editing your manifest.xml files with an external editor like ACE and then importing it again. Or maybe create the shortcuts while still in the monitoring phase.

 

Normally you just choose the correct ApplicationID from the list in the Manifest file when you open it from ACE editor.

 

If you don’t see the correct .EXE file there you have to do some additional steps to add them.

First of all, in this example I will now use the NOT free editor AVE because it’s way faster and safer then editing the manifest.xml files. If you don’t want to pay for this, you could try adding shortcuts to your programs during seq. mode or just editing manifest files with ACE.

 

First go to “Virtual applications” in AVE.

 

Then press the “Publish new application” button, and choose browse package for the correct .EXE file.



Choose the correct .EXE file and push SELECT.

Now it will be available to use for “Start Process” scripts.

Next in this example we have been sequencing “Phillips Intellispace”.

This application was pretty straight forward to Sequence, but you need to be aware that the software will always check for content verification from the IntelliSpace server. This will cause an error as it can't write some files to the VFS. We did a quick procomon trace, and also tried a quick shimming fix, and a junction point fix without any luck.

 

If you press the ok button it will work as it should, or wait for about 60sec before it would auto close.

So the application works as it should, but this error will be confusing for any enduser and that is why the user start script has been created so it can supress this error.

Using Tim’s excellent AppV_Manage debugger we could see the problem process showing the error message was called AppletHost.exe

 

So, we needed to make sure Applethost.exe process was intercepted and killed on every first launch of the main program, so the error message would not be seen by the end user.
But it was important it was only on the first launch of the AppletHost.exe, so to make this happen we ended up making a small but effective powershell script that put a registry “detection rule” in HKCU on the process after the first “kill”. We hooked it up on to the process logviewer.exe.

We wrap all our scripts into a cmd script, only running the powershellscript it would then look something like this:
powershell.exe -windowstyle hidden -File "RegCheckandKill.ps1"

 

Script is running inside the virtual Env.



Wrapped inside “userstartprocess.cmd”

 

This is our small startup ps script, running it once and creating the registrykey makes sure it will not be killed again since Applethost.exe could still be used for other things in the program.

 

 

We then hooked another small PowerShell script to the exit Process script “WorkflowHost.exe” we would then delete this registry setting so it will be found again on next launch.

 

 

 

 

The “DeleteRegKeyonProcessExit” powershell script.

 

 

And as always, hope this will be of help to someone.

 

 

How we ended up making our own APP-V automation & workflow tool

Backstory:

(If you don’t want to read all my mad ramblings, then go directly to the part “Our tool” =)

During our previous Windows Xp to Windows 7 migration (2013-2014) we upgraded approximately 13000 computers, then as now we were using Broadcom (formerly Symantec) CMS(Altiris) for deployment, and ended up repackaging over 400 different virtual packages with Symantec SEV (Symantec Endpoint Virtualization).
That format was great for compatibility, and for the most parts it worked pretty well once you knew it's bugs and quirks, but we had to throw it away after Symantec made us aware in early 2017 they would EOL it from the summer of 2018.

After a lot of research and testing, we decided that our Windows 7 to Windows 10 migration would be all about APP-V. That way we could also reuse most of our new App-V packages on our current Citrix environment, and in future VDI solutions.
We were concluding it is the only virtualization tool big enough not going EOL on short notice like SEV. Repackaging, testing and upgrading all your major applications into a new package format is for sure one of the most time-consuming workloads in larger IT organizations, so we didn't want to do that again anytime soon.

Coming from another advanced virtualization technology, the first thing I noticed was all that things it was different and missing compared to SEV, mostly in terms of functionality, compatibility and flexibility. SEV was behaving much more like a normal MSI install on computers, so we could capture all services, printer drivers and we could even patch up applications like Ms Office directly into the writable virtual layer using Windows update.
A lot of the things I think APP-V is missing compared to SEV is obvious a result of the overly strict isolation design and the restrictions it has that's blocking updates of executable file types through copy on write (COW), so I wanted to get some of that back from fully understanding the technology, and try to fix it during the process from Sequencing too deployment through scripting and/or workarounds.
Another issue for us was the very time-consuming and less than user-friendly implementation when adding many scripts on each Add/Publish/Remove /Unpublish event through Scriptrunner.

So I booked myself  and a colleague an advanced APP-V training class in the Netherlands early 2017 with the godfather of APP-V, Timothy Mangan.
I learned a lot but I also ended up with a lot of new questions I needed answers to after that training class.
First off all I wanted to integrate the installation of App-V packages better with Altiris, I tried reaching out through our Symantec contacts and even through forums, but nothing solid came back so I had to find my own answers.

What 3rd party tools are out there?

Looking at all the App-V tools I could find out there I built a list of pros and cons.

(Note, Tmedit was not available at first when we made our first tests and automations for detection rule scripts)

Ms Sequencer is not my first or even second choice as main APP-V editor, I think it's outdated and slow for that purpose. It's not giving me much more than being really good for capturing packages, after the first sequencing part you should close it up, and go on working using other tools. 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhypnxR1dIREF6mJahH-HEobfv8tcKjxiai8MjDNj16tF5dcUXz-QRYYJwdTUzbO1TYXjSvzlqK7bavbSQ156r6vHUvWbodE2AV34dZX6Hp6unIXCnlX01Vkz0kpJAad0I8nAzczPacjUQ/s320/seq_main+page.PNG

Ms Sequencer screenshot

 

That’s where AVE, Tmedit and Tweakappv comes in handy. They do all give you some extra functionality and possibilities the other programs lack.

Also, you can buy bigger and more expensive solutions like Flexera Admin Studio, RayPack Studio and Advanced Installer, but they are overly expensive and complex for repacking installs into APP-V format IMO.

AVE is not free but well worth the price tag since it will save you a lot of time on small edits, it has by far the nicest GUI and overview, and is the fastest overall editor. It’s really good for editing small stuff like shortcuts, extracting and importing files and folders, plus registry values and turning functions on and off.

But I really can't get used to the script part, and the automation part is not to good IMO, then you have to buy the not free Lib-V, but which is a fantastic product if you want to build your own tools, and Auto Sequencer fixups.

My favourite tool for quick edits and looking into packages.

 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPo4dmjB62p30tpD4K7PS8TS-Ph3cbYj-o5Qs3gZcaPH1fRPVR_SUYeDrsg-Du2FTt7UzgaCP6IXBGEpUT_9zNpQUfquI5aaZUOQ8OxWJX8SC4gtvjXydJOJys7RGKuZDaXk1h9A4x3i4/s320/ave.PNG

AVE screenshot

 

Tmedit is also not free, but it has an amazing “Analysis & Fixes” toolkit, and it will help clean-up junk files and optimize stuff most of us don’t even know about. It will also give you a lot of good tooltip information about every App-V function, and the automation framework is really good. And Timothy Mangan update this tool very often, sometimes he even solves Sequencer bugs before Ms does.

My favourite tool for clean-ups and fixups.

But not my favourite file and registry editor, but it will do its stuff, also not very fast when opening and saving large App-V files compared to AVE.

 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYIaP1gZA0gt6sJ0MVkBFU36udYSeQ7QgXw-od_zl0s2gyJd1LogESaYS9X_TktWxDusbt6vGRWN6-X3nExwH8ab8zhDCTPiw_zfclmab_l66U3mmHYbTr-WFCzgykptatGq8iM75D7tk/s320/tmedit.PNG

Tmedit screenshot

 

Tweakappv Using this small and free command line tool from Advanced Installer we have finally found a working command line interface for modifying files and properties inside our App-V packages without using manual editing and without triggering the internal App-V CRC check.

This way we can automate the creation of scripts, we use it for Altiris detection rules with App-V packages, but Broadcom (formerly Symantec) has later updated CMS to support and can now detect App-V and App-X packages.
If you search the rest of my blog and google you will see a lot of examples of free tools and examples we have created with it, and things it can do for you.
The CLI interface can do most things directly, but some more advanced edits must be done through Xslt transforms, but if you do master this you have a winner :)

My favourite tool for automation.

Use case: We have used it in scripts that treat reading and extracting internal manifest files from App-V files with 7zip command line version).

When we have the AppxManifest file on our computer we create a script/program that read from the xml file.

Find things like "Identity Name",'Version="', 'appv:PackageId="' and 'appv:VersionId="'.

Using string split or an xml parser to get the values and store as variables in your script.
Then update them in our own tool and send them back through Tweakappv.

Tweakappv screenshot

Choosing delivery system:

Based on our own experience I wanted to have the possibility of a streaming solution for both users and machines since we’re using the same package format, but still avoid having to maintain another complex solution with databases if that could be avoided. Less things to maintain and patch. So full infrastructure was out of the question for us.

Today we can do both through the paid version of AppVentiX (formerly known as AppvScheduler), but we still install most our Global published programs through Altiris because we already automated all the scripts, commands and documentation needed for that scenario through our own tool, and we have a better possibilities too maintain pre. req. checks on our computers, and also inventory data.
We also created a little compiled PowerShell program that we use too deploy our App-V packages and CG's, it's checking the state of all active virtual processes on package publishing. It's giving our end users the option to save and close down active applications when needed. It's also giving us the option too auto close certain applications, and presenting it too end users with a friendly name in the message box from our own INI file.

We have now finished developing our own custom GUI version of Psappdeploy toolkit. Making use of all its functions will enable us to deploy pre. req. with App-V scripts during Add and Remove phase. But it will come with the cost of a larger start-up block making streaming slower.

On a pure Citrix/VDI solution AppVentiX is the “only” way to go IMO. Giving you lots and lots of tweaks for that scenario, and no need for any extra infrastructure.

Why we ended up creating our own tool?

Most of my readers would probably think that our journey was over by now, we had bought ourself several good 3rd party tools, and we could now : Change most package settings, and also sending scripts automatically into all our packages using Tweakappv.

The main reason was eliminating manual labour, that will both make you more efficient while avoiding human errors.

But to be honest, I am pretty lazy when it comes to doing routine jobs, and so are a lot of my co-workers. And that's actually a good thing if you have some spare time and programming skill set at your disposal, always try to automate as much as possible.

I tend to think I am pretty average when it comes to programming, but I think I have a pretty good eye for what could and should be automated due too years of experience, so when I see something is a good fit for automation I make up a small working script/program using google and my own ideas. Usually looking for CLIs and APIs to interact through.
During packaging that's often more than enough to make all the normal automations like I have explained here.

But if you are going to build bigger and better programs/scripts, you should be wise getting someone on-board having real programming skills.
Or you may use to much valuable time studying and doing trial and error before maybe getting the desired result.
I'm happy I have someone like that on my team, so for the last couple of years I have passed on my more complex request to him.

And that's how we ended up creating our own little tools: “HnAppvtool”.

At first it was supposed to be all about making automating scripting and documentation already having paid for AVE.
But we also wanted to change back GUID’s, versions and naming on the package so we didn't have to change previously command lines and scripts created with our own tool during testing.
But as time passed on we saw the potential for more automation.
Especial I wanted to see a log of all the major changes done from AVE and TMEDIT compared to the first package from the Sequencer tool.
So we integrated those programs into the tool, so all COM integration settings and file and registry changes would be written into our documentation file.
That comes in handy when you have to check up old packages without having to open them up.

Also, we would take new package revisions from other tools directly into the tools and finish all the job in there.
The end result we are working on today is made using pure PowerShell code and GUI. 

UPDATE (20.05.21): We still use this program for first time installations, but if the program is being Sequenced more than one time we try use the AutoSequencer.
My programmer has rewriten this program from scratch using C# and Lib-V.

Mostly because of speed, but also because he thinks the codebase was not that great, he has learned a lot since the first version.

Our tool:

Should have done a video showing how we use the tool. But I don’t really like hearing my own voice trying to speak “Norwenglish” (English with Norwegian accent), so you have to settle for just some screenshot.
There may also come a time when we can release our complete codebase on Git like we have done before with other tools and concepts, but we need some internal discussions with my bosses about that first….

Also, some of the text is in Norwegian so we need to translate it all.

Main window:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvZUW_LKozb556yIuyyQjaCNHdGbw09QyTx09NeaLlBFqzNeHYLosN93VSZ1V4NtkW_zwtmgjlhJ2Ii5tweEuyQcfTgrG__9dGbqv7E2hE0w_W2P8A2GCs5baU1rbVhnYiWD_QibUhj2Y/s320/hnappvtoolkit.PNG


In this window you can load your APP-V file, or your complete project using the “Kilde” button. It's translated to source in English.

“Kilde” file will contain all the files and versions used from your first App-V file was imported.


Loading App-V file:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPNXujOpGF40RfFyd-33CT3yQl9IKw62dsHF0Kaq4xMgtjt-Nh5kkUCm_HBim8h-z83Y4-8IR68zBvUi0tg3ix469Y51OY-n8iwBc4cj3CKL8UsrfY2K-HC1B8a140N_HN8-8-P9bi_qc/s320/hnappvtoolkit1.PNG

As you can see here, all information about GUIDS and advanced package settings is on the first page. Giving you easy control over that part.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj82cDQ5Py1dD6Oc-ibxPFALRovetP12-WfMU7oOX3FvxTQAS3lMUyiSYNhluRb2xGuJFFSKXF-MtcTTbVmJf6pw2jJjtxYzMNFSH9FDmxEvAlMtZOzJqg0W25RcUe0caXmVD163BWyh7I/s320/console.PNG

Also, there is a console view, showing the complete log of our program.

How to update all isolation settings:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhWklUrcitdIyFMu_NAMvUTSflnFZTsORv2S6z8nIJmZE-yW0bmd9V0JTsBgy9DthfDuR6idEToBQUVoKrUGQYXl8Dqf1Y1S-uj-k216GsWyuP2P_EoxW6LNpgfPYOZV9QRdwekDOEpgs/s320/hnappvtoolkit2.PNG

Just check the wanted settings and then hit the Compile button.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfYpFK4Z9krvjq6xUhvQVzQquWoMnozqhSwG88IZ-0u_YnSs7NVS_b-6HtySM1xzV6wXXbv_RChd6qqn22kb8YT2K7HtIOWw51P7f3IY5PVD4ra0yogufocewf1QJGE26hPNqVvuGGYVs/s320/hnappvtoolkit3.PNG

After a while it will be finished, and the new settings will be updated in the GUI.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-5VZgFWvb9lPHoUNrf_39NMJRE_uXxkRbi4aAwAeVCfr3cB5_EMS5bVI1kZNv2z8Nb8kWp9ThB78kWmr44yOvTnahBl66W6f8E2sfqwiLe5lBqC67-Qe27TVpqrXwlvrHpX-S3x6Xrgo/s320/hnappvtoolkit4.PNG

This box shows us what has happened during the compile phase.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVmvB9nccamDkVWXAEmeKYv52RggriPMyz3qLT7DyPb44qUAI-k6w0ohL8CQK-YTLutTx1iaIm2ByaWlR6MARIJ3UsL4Wpu3iAajwTvV1LBOcIp29zoP22sKe38mNjgbqLIJmZ4o280Lk/s320/hnappvtoolkit5.PNG

And the new settings will be updated in the GUI.

How to work with AVE and TMEDIT:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJVz6tGzNrkrE0SpWKuMHk0mkfTUUxOxCAPgU8XxS2S8YJdkbFGZlOe2glTzreM6IBX2vRcM1ev84Fos2omACQZcOdlGbW2ZhMDztTy0XMYfIAHxN4Jtl6INf9s78HO3iYdflPJXkZCI8/s320/hnappvtoolkit6.PNG

If we want to work with AVE and TMEDIT, the following save settings has to be configured within those tools.
It will be available as a tooltip if you hit the button marked with yellow on the screenshot.

Then you just have to press the TmEdit and AVE buttons. And those tools will start up. Do your stuff there, save package, and close the tool.

Our tool will then ask if you want to accept the changes from those tools into the current project.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTvoUo8ij5aj4dFqcrs-PYuFw1ghCM8lxgkLQojWX025bEYh44uKs7Asbn406CPsxYW_fVi5_dSTFHaxUqjX6fkgy_fYrNmui8gR4tDoIexO_YDhymCWykGaqWMKU_EF_oxQzBBK-HUbw/s320/accept+changes.PNG

Accept changes buttons

“Ja”, is the same as Yes, and” Nei“ is the same as No.

You can always go back too before those edits if you have ticked the box “Lagrer app-v før AVE o.l. sine blir lagret.

Meaning “Save app-v before AVE and other edits gets saved”

“TmEditAutooUpdate” button:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOC9laubn6XAe4M5CVKGYnPviTNuMs4MGWt8kZWuCqv2GaJNx8j9JBTSHfc4oYOLpezdekjZjfSAo6CH8kwyoxMpanpeiViTi6lZ6bxPiAlTtEIGdmOCetg7Vt69mAOfQGBypNego3SRY/s320/hnappvtoolkit7.PNG

This button will let you set and read all tooltips related too what can be changed using that tool.

Machine Scripts:

Coming from SEV I missed having the possibility of creating several separate scripts per event, and how easy it was too change running behaviour by moving them up and down using arrows in the Composer.

So, we tried to mimic that behaviour as best as possible.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDaWI0JsSX8M2HQQMAHB0Sxt4S72dmMA2iEr1yrHuzkgeYbAzRBYJfmJlOIkw64rTeTUPjhmCrC2EQPE7D3eOxgRKxBS6kXo4Fuhon6BdK4eWbhwz36l9tN2eaqZhl7yQrUvaClDhyphenhyphenENw/s320/machinescript1.PNG

Adding script number 1 by pressing “New Script”.
The way we did it was making a simple but effective CMD script parser, so each subscript would be added into the main script. We are just using notepad as our paste editor. That is something we are going to change when we have the time. But for now, we make all our scripts in another editor and paste them over.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwxnH7mQhkUl-QCrVqsA0V_uL8i5O_utfUl1cFil8wLxNQyeQKtuK4LLjVN8YNz7nO_dB6Raj4oszhYBV0x1tepREewulXxKjSt9PWeEY3buDn0-oI0kXH3aO4ZpA5HrX1l0n6ANoQxQc/s320/machinescript2.PNG

You can now see there is one script in the Machine Add main script.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCZdaTRet_BmCINe13fyus5wIaS-dMAqb8wLneQYyLfHAoRZlTU8d8KdDH-P3yNpzsLFejU43VhFPWGpVNl5mfnRB2YmBj5TOjFzxx90Ho_Q-ofwcKVehURC8meYnSLVD3du8b-qNScGM/s320/machinescript3.PNG

Here we have added another script

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5ClNysJlksO-iNogKMjPgL_RBzY5CehmiRTeDq8x4a1PxpRSJs7-VGXS1GpvJ-jWnB0gQOTeSuuhyD3jLOvIXu8bhLC72RRmqanbmE1ZiE04LC_6QFMTSCzZIi3UcuyoZJtvSlhLQ4pI/s320/machinescript4.PNG

Here we have moved our 2nd script up, and it will be auto renamed “0001_” in the first part of the name, but the last part of the name will show us the original script name.

Since it’s based purely on CMD (batch) it will let you run PowerShell scripts, Vbscripts and everything else as long as the command lines are correct.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIe67jwYLiI15dFgo_4x9EvrZolGezHyHaG-Q-4GrxUusW9XvaD1Nu-jWxEe7Luz3oOg12RzuJV6mRF38UItZgJDMeKLuJhTk1q2jx6fD9XTeakA3aiJSGp58bO4FZKoxa7lEf8pG5AcI/s320/machinescript6.PNG

Adding files into script directory:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXSxFd1dd3_cK2T0yT8Kvy9UCOHcCEq1PtR9PFNbSPFzSD6mYdgSkbBz0d1H9MDCzRpXviJiLfeNLQBEROEGhmGPWvJgFubYxeKPde9cbnAmFkiieky972cfLTrYOEmTcD7yfUHO4x-i4/s320/machinescript7.PNG

Using the buttons “Add” and “Remove” you can also add and remove script files into your App-V script folder.
You can also see I have created test scripts on all 4 Script events.

Then we just hit the button “Lagre og Fortsett”. Same as Save and continue in English J

One Easter egg is that you can edit and put scripts directly into the working event folder for the project on the disk, and it will be added during compile!

 

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_Pt9TsdXw_lb4sOD98mVLJVXefBMwbWJqmTIMv43tfPMzQZlaVXcKH1FDbeGlbJ4qBZRLeFtK_5IqQRNYanvELHhoSgw16zXoR88X1tXrm3WRcNxtbHCR75lMpBhm_GkZXgHLUUVNXh4/s320/scripts_folder.PNG

Scripts folder

This is how our finished CMD script will look when deployed on your machine.

@echo off

set hh=%time:~0,2%

if "%time:~0,1%"==" " set hh=0%hh:~1,1%

set dt=%date:/=.% %hh%%time:~2,6%

if not exist "C:\company\Appv\Scriptlog\" (mkdir "C:\company\Appv\Scriptlog\")

:Script_1

cd c:\temp

Dir

If not %ERRORLEVEL% == 0 (

Set ErrorKode=%ERRORLEVEL%

set Scriptnr=1

Set Info=AVSLUTTER!!!

Set Go=Ende

Goto ErrorHandler

)

rem ---------------------------------

:Script_2

mkdir "C:\temp"

If not %ERRORLEVEL% == 0 (

Set ErrorKode=%ERRORLEVEL%

set Scriptnr=2

Set Info=AVSLUTTER!!!

Set Go=Ende

Goto ErrorHandler

)

rem ---------------------------------

:Script_3

Rem --- AltirisMachineAddPackage Roule ---

reg add "hklm\software\wow6432node\company\Appv\test_123" /v AddPackage /t reg_sz /d 0.0.0.2/0759fa5e-74a1-4012-9f61-6babefff6cf3/4f1943d9-c43a-40b0-b411-cc0151c873f7 /f

If not %ERRORLEVEL% == 0 (

Set ErrorKode=%ERRORLEVEL%

set Scriptnr=3

Set Go=Ende

Goto ErrorHandler

)

rem ---------------------------------

Goto ende

:ErrorHandler

Echo %dt% >>"C:\company\Appv\Scriptlog\test_123.log"

Echo %Info% >>"C:\company\Appv\Scriptlog\test_123.log"

Echo PakkeID:0759fa5e-74a1-4012-9f61-6babefff6cf3 Versjonsid:4f1943d9-c43a-40b0-b411-cc0151c873f7 Versjon:0.0.0.2 >>"C:\company\Appv\Scriptlog\test_123.log"

Echo MachineAddPackage.cmd: Feiler i script nr %Scriptnr% Errorkode: %Errorkode% >>"C:\company\Appv\Scriptlog\test_123.log"

Goto %Go%

rem ---------------------------------

:Ende

As you can see, most of the stuff is logging, Altiris scripts and error handling.

The reason it wasn’t made in PowerShell is simple, we had a lot of different PowerShell versions back when this was developed, and it was also faster developing and deploying this.

Userscripts:

Almost the same as MachineScript, but with the extra options you only need for userscripts.

One complains we hear about is that there will be blinking CMD windows when userscripts is running. So, we need to wrap them into and exe or vbs too supress them. That’s is one thing for a future revision.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioJnIMo2poQ7ZqeGG9j9c21zndYmDbZMM2Mq3QK0Gn2X1_nt0O_X5KyYHrRPEkVsaaFFlE7auzcQMW15rnW_um3KC8QCFi904HC_0GjNpcyyPMPBq0EOKPBB0PUs-DEp4MX74365qvyyo/s320/userscripts.PNG

Userscripts screenshot

Registry viewer:

I found a great free registry tool some time ago and wrote a blogpost about it. We have been modifying it a lot too suit our purpose.
It will now fully understand all special App-V related registry keys, and is also modified too run as a command line tool during compile so it can write all changes into or Description file.

If there is more than 40 lines of reg changes it will only show how many changes we have done, and put a reference to the complete changelog file for you to see all changes.
You can also fire it up in the GUI mode from the tool if you want to view them directly. But big registry trees will often take some time to create.

Registry viewer screenshot

There are also two different buttons giving us different GUI views for folders and files in the tool.
But after we integrated AVE and TMEDIT into the program we haven’t updated and perfected this.

But it makes it possible to add, view and delete files and folders directly from the tool.

Documentation:

One of the most important parts of our tool is too create our documentation after we are done with the package.

That way you don’t miss up logging small last-minute changes… (who hasn’t done that? )

Our program has 3 buttons for Documentation, called “Description for the complete doc” and “Pre.txt” for the steps you do before Sequencing.

And the last button “Sequence.txt” for what you do during Sequencing.

It’s just txt files so you fill out everything and it will be created like this.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieoQ15_sakkbFwiLJBKbeoji-LGheE3yIh3AiYB4bm1m8EjaCAwLEDgmdUq1PtnxpGmFomEas2U0d5yefyhmZpMJQBMUoWH5JQpRW1bRPOs7Y1NMX2nC-aQ4Y4uhsUs6KPV1seNlkVwko/s320/documentation.PNG

Screenshot of our documentation file

And the last part containing file and registry settings and COM settings:

Also, some Altiris stuff and all deployment PowerShell command lines, not on the screenshot.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7VAZYq02FkjWobQR-Coqe_cQCeQd60He1yBucwmJJqrjseY4hJhTrFLVPuQeSmAURsXfeWO9FNMi76jmzy2xwJQ1RiQGNE1pR4nPDwh3uYwAwQWgPs5QrtUQfh1AjTlDrsDsFXb4NZFw/s320/documentation1.PNG

Another screenshot of our documentation file

End credit:

This tool was developed in between other tasks over a period of 2 years, and most of my small team have been active in bug testing and the development of new functions.
Would not have been possible if we did not work together as a team!

Hope this blogpost will inspire someone else to create your own tools when there are no perfect alternatives out there.

How to Sequence Sas Office add-in 8.2

In the past I would consider ”SAS Add-In for Microsoft Office” as very easy  to sequence, and 7.15 hf3 was working well without doing anything special.

But after we tried to sequence the latest 8.2 version on W10 build 1809 with Office 2019 (x86) installed into the Os, we had some problems getting the COM plugin to load when we put the package in a Connection group with lots of other packages.(Worked  sometimes when deployed with just a runvirtual key to Office)

We tried both with and without different VSTO versions  in the base Os, and also tried to seq. it into the package for testing.

And we even tried Seq. on 1709 and with Office 2013 (x86) in base with no luck.

So I had to investigate further using a Procmon trace of the manual install vs the sequenced install, and noticed the correct COM entry’s was not created during startup with the package in CG using the create entry’s in the package.
This entry seems to be the place where it creates the key corresponding to the correct office version with 15.0 for 2013 and 16.0 for Office 2016/365 or above : HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\User Settings\SAS Add-In for Microsoft Office\Create\Software\Microsoft\Office\Excel\Addins\SAS.ExcelAddIns and the same for Word, Powerpoint and Outlook.

Having repackaged a lot of Office plugins over the years I found the missing keys, and created a regfile with the missing  keys, and imported them during the  capture. I deselected outlook addin during install so that’s why it’s not there.
But it’s in the same place.. HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\outlook…..

The regfile is like this:

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel\Addins\SAS.ExcelAddIn]

"CommandLineSafe"=dword:00000001

"Description"="The SAS Add-In for Microsoft Office allows you to access the power of SAS directly from your Microsoft Office application."

"FriendlyName"="SAS Add-In 8 for Microsoft Office"

"LoadBehavior"=dword:00000003

"Manifest"="C:\\Program Files (x86)\\SASHome\\x86\\SASAddinforMicrosoftOffice\\8\\SAS.ExcelAddIn.vsto|vstolocal"

"Version"="8"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint\Addins\SAS.PowerPointAddIn]

"CommandLineSafe"=dword:00000001

"Description"="The SAS Add-In for Microsoft Office allows you to access the power of SAS directly from your Microsoft Office application."

"FriendlyName"="SAS Add-In 8 for Microsoft Office"

"LoadBehavior"=dword:00000003

"Manifest"="C:\\Program Files (x86)\\SASHome\\x86\\SASAddinforMicrosoftOffice\\8\\SAS.PowerPointAddIn.vsto|vstolocal"

"Version"="8"

 

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word\Addins\SAS.WordAddIn]

"CommandLineSafe"=dword:00000001

"Description"="The SAS Add-In for Microsoft Office allows you to access the power of SAS directly from your Microsoft Office application."

"FriendlyName"="SAS Add-In 8 for Microsoft Office"

"LoadBehavior"=dword:00000003

"Manifest"="C:\\Program Files (x86)\\SASHome\\x86\\SASAddinforMicrosoftOffice\\8\\SAS.WordAddIn.vsto|vstolocal"

"Version"="8"

 

How to Sequence:

I recommend installing the VSTO tool into the base Os.
Same for the vcreds. Install all Vcreds from package into base OS. Also install them on your production computers.

Latest Ms Office (2019) the installation source files into base OS.

(Os need to be rebooted after installation.)

Example of install cmd script for silent install of vsto and vcreds, may be newer versions so check that out, my sample file was from 7.15hf4 version.

echo Installing (1/7): vstor redist-

%~dp0prereq\vstor\vstor_redist.exe /q /norestart

echo Return Code: %ERRORLEVEL%

::

echo Installing (2/7): VC++ 2013 x86

%~dp0prereq\vcredist2013\vcredist_x86.exe /q

echo Return Code: %ERRORLEVEL%

::

echo Installing (3/7): VC++ 2013 x64

%~dp0prereq\vcredist2013\vcredist_x64.exe /q

echo Return Code: %ERRORLEVEL%

::

echo Installing (4/7): VC++ 2015 x86

%~dp0prereq\vcredist2015\vc_redist.x86.exe /q

echo Return Code: %ERRORLEVEL%

::

echo Installing (5/7): VC++ 2015 x64

%~dp0prereq\vcredist2015\vc_redist.x64.exe /q

echo Return Code: %ERRORLEVEL%

 

Sequencing information included in the documentation file
------------------------------------------------------------------------------------------------------------------------------------

Documentation for App-V-Sequenced application: SAS Office addin 8.2

Documentation created: 25.03.2020 16:31

 

Installation

••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

 

Sequenced on Windows Version:10.0.17763.0 system with App-V Sequencer version: 10.0.17763.1

Sequenced created:25.03.2020 15:27:29

 

••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Appvnavn:SAS Office addin

Version:0.0.0.5

PackageID=989c4592-8ace-49fa-9a89-80218be427b5

VersionID=12fc5ea0-e4ea-483e-a6c1-387eaba2c43f

••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

 

-----------------------------------------------------

Prerequirements before Sequencing:

-----------------------------------------------------

Latest Ms Office (2019) must be installed together with the attached (VSTO) vstor_redist.exe  from the installation source files into base OS.

(Os need to be rebooted after installation.)

 

-----------------------------------------------------

Sequence Install with the following parameters: Install all package Vcreds into sequencer machine, could be found in vcred folder under application when installed. Also install them on your production computers.

-----------------------------------------------------

Sequence Install with the following parameters:

-----------------------------------------------------

Load your appv template file

Remove vcreds capture from package

 

Sequence as plugin.

Run "install.sas.officeaddin.cmd" file from installation source files. It will Turn off all languages and Deselect Outlook addin.

Install script will also install custom regkey and then copy "%SAS.OfficeAddin.dll.config" to "%ProgramFiles(x86)%\SASHome\x86\SASAddinforMicrosoftOffice\8\" 

 

Save package.

Open in TMedit. Cleanup package, except .net compile and merge of registry keys.

Save package.

 

Open package in AVE and delete all extra shortcuts.

Save package.

-----------------------------------------------------

Package information:

-----------------------------------------------------

-- Machinescripts --

-----------------------------------------------------------------------------

  On Add Package:

    MachineAdd.cmd  (For details see Source.exe)

    Script Altiris Rule:    

 

    Rollback:1

       Timer:60

  On Publish Package:

    MachinePublish.cmd  (For details see Source.exe)

    Script Altiris Rule:    

 

    Rollback:1

       Timer:60

  On Unpublish Package:

    MachineUnpublish.cmd  (For details see Source.exe)

    Script Altiris Rule:   

 

    Rollback:1

       Timer:60

  On Remove Package:

    MachineRemove.cmd  (For details see Source.exe)

    Script Altiris Rule:    

 

    Rollback:1

       Timer:60

-- Userscripts

-----------------------------------------------------------------------------

Added Scriptfiles:

    MachineAdd.cmd

    MachinePublish.cmd

    MachineRemove.cmd

    MachineUnpublish.cmd

------------------------ COM - OPTIONS -------------------------

FullVfsWriteMode: True

COM:Integrated | InProcessEnabled = false | OutOfProcessEnabled = true

DiableBrowserPlugin = false

Object Isolation Exclutions:

*

-----------------------------------------------------------------

REG - INFO:

c:\Temp\Appv\Doc\000_Registry.dat:

Node Keys: 4641

Value Keys: 6125

c:\Temp\Appv\Doc\007_Registry.dat:

Node Keys: 4650

Value Keys: 6143

Nodes Deleted       : 0

Nodes Unchanged : 10766

Nodes Modified      : 0

 

REG - CHANGES:

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel\Addins

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel\Addins\SAS.ExcelAddIn

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel\Addins\SAS.ExcelAddIn\CommandLineSafe: 1

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel\Addins\SAS.ExcelAddIn\Description: The SAS Add-In for Microsoft Office allows you to access the power of SAS directly from your Microsoft Office application.

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel\Addins\SAS.ExcelAddIn\FriendlyName: SAS Add-In 8 for Microsoft Office

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel\Addins\SAS.ExcelAddIn\LoadBehavior: 3

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel\Addins\SAS.ExcelAddIn\Manifest: [{ProgramFilesX86}]\SASHome\x86\SASAddinforMicrosoftOffice\8\SAS.ExcelAddIn.vsto|vstolocal

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Excel\Addins\SAS.ExcelAddIn\Version: 8

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint\Addins

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint\Addins\SAS.PowerPointAddIn

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint\Addins\SAS.PowerPointAddIn\CommandLineSafe: 1

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint\Addins\SAS.PowerPointAddIn\Description: The SAS Add-In for Microsoft Office allows you to access the power of SAS directly from your Microsoft Office application.

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint\Addins\SAS.PowerPointAddIn\FriendlyName: SAS Add-In 8 for Microsoft Office

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint\Addins\SAS.PowerPointAddIn\LoadBehavior: 3

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint\Addins\SAS.PowerPointAddIn\Manifest: [{ProgramFilesX86}]\SASHome\x86\SASAddinforMicrosoftOffice\8\SAS.PowerPointAddIn.vsto|vstolocal

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\PowerPoint\Addins\SAS.PowerPointAddIn\Version: 8

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word\Addins

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word\Addins\SAS.WordAddIn

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word\Addins\SAS.WordAddIn\CommandLineSafe: 1

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word\Addins\SAS.WordAddIn\Description: The SAS Add-In for Microsoft Office allows you to access the power of SAS directly from your Microsoft Office application.

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word\Addins\SAS.WordAddIn\FriendlyName: SAS Add-In 8 for Microsoft Office

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word\Addins\SAS.WordAddIn\LoadBehavior: 3

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word\Addins\SAS.WordAddIn\Manifest: [{ProgramFilesX86}]\SASHome\x86\SASAddinforMicrosoftOffice\8\SAS.WordAddIn.vsto|vstolocal

Added:ROOT\REGISTRY\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Word\Addins\SAS.WordAddIn\Version: 8

 

 

FILE - CHANGES:

Changed:StreamMap.xml

 

 

••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Altiris detection rules:

                - PublishPackage:

                               HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\COMPANY\AppV\SAS Office addin

                               PublishPackage=0.0.0.5/989c4592-8ace-49fa-9a89-80218be427b5/12fc5ea0-e4ea-483e-a6c1-387eaba2c43f

                - AddPackage:

                               HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\COMPANY\AppV\SAS Office addin

                               AddPackage=0.0.0.5/989c4592-8ace-49fa-9a89-80218be427b5/12fc5ea0-e4ea-483e-a6c1-387eaba2c43f

 

••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Powershell:

-----------------------------------------------------

Add Publish Mount commandline Powershell:

                powershell.exe "Add-AppvClientPackage -Path 'SAS Office addin.appv' | Publish-AppvClientPackage –Global | Mount-AppvClientPackage"

 

Add Mount commandline Powershell:

                powershell.exe "Add-AppvClientPackage -Path 'SAS Office addin.appv' | Mount-AppvClientPackage"

 

Publish Mount commandline Powershell:

                powershell.exe "Publish-AppvClientPackage -Name 'SAS Office addin' –Global | Mount-AppvClientPackage"

 

UnPublish Remove commandline Powershell:

                powershell.exe "Unpublish-AppvClientPackage -Name 'SAS Office addin' -Global | Remove-AppVClientPackage"

 

Unpublish commandline Powershell:

                powershell.exe "Unpublish-AppvClientPackage -Name 'SAS Office addin' -Global"

 

Unpublish Remove Widh PackageID and VersionID commandline Powershell:

                powershell.exe "Unpublish-AppvClientPackage -packageid 989c4592-8ace-49fa-9a89-80218be427b5 -versionid 12fc5ea0-e4ea-483e-a6c1-387eaba2c43f -global |Remove-AppvClientPackage"