App-V 5.0 Sequencer and Reboots

App-V 4.X

Previously, in App-V 4.X, while sequencing you would never have to reboot. The idea, which worked in most cases, was the sequencer would simply – while in monitoring mode – execute what ever was in queue for the next startup before proceeding to the next part of the sequencing process.

This list of things to execute would be gathered and executed once you hit Stop Monitoring. Stop Monitoring was a button available in the sequencer up until App-V 4.6 and this could also be pressed multiple times. In App-V 4.6 SP1, and forward, changed the workflow of the sequencer and suddenly the button Stop Monitoring was not available. You could suddenly not hit this button multiple times, but simply check “I am finished” and click Next. Unfortunately – you could not go back. Multiple reboots were suddenly a hassle – as you would have to save the package and return to the start of the workflow to initiate a second reboot.

There had been a few known cases (never personally hit them) were reboots were simply not handled as nicely as one would like in this workflow. As always – things can get better.

App-V 5.0

In App-V 5.0 this changed drastically and now you were commanded to perform the reboot. The experience would be that at any time after the actual monitoring process started  a reboot could be executed, and once the computer starts up again the sequencer will resume operations.

Reboot.exe is the process that scans your computer and apparently it saves the state into a sub-key of the App-V sequencer.

image

HKLM\SOFTWARE\Microsoft\AppV\Sequencer\Resume is the place to watch out for!

Under Resume there is a Serialized State that seems to explain where the current state of the package is;

image

I haven’t personally experienced any issues with this, however quite a few people have. As far as I know they have always a few things in common;

  • The sequencer workstation is domain-joined
  • Its running as a virtual machine

Problems

What happens if you perform a reboot and you do have an issue?

Firstly – the sequencer can catch that it hasn’t been allowed to prepare enough for a shutdown;

the sequencer was unable to prepare for a system restart.

If no error message is presented this means that the sequencer was given enough time to prepare the sequence so that it should be successfully resumed once the computer is rebooted. However, something else can interfere during startup and then this happens;

image
An error encountered while trying to start the monitoring session.

Event Viewer

A good idea is to check Event Viewer under Application and Services –> Microsoft –> AppV –> Sequencer and the Admin-log.  By manually crashing the sequencer and just attempting to restart it this was generated;

An attempt to start the monitoring session failed (The process cannot access the file because it is being used by another process)

Run / RunOnce

You could avoid the reboot and manually locate what needs to happen for the application installation process. A tool to use in this process is Autoruns (from Sysinternals) or poke around the registry for potential clues in the Run registry key. Once you identify what is set there to run at the next reboot – simply run it to get it into the monitoring process. Hopefully this will allow you to proceed without having to deal with the reboot in itself.

Or you could to try to resume the sequencer again. I can’t say that I have been able to test this in anyway, but once a reboot is initiated the sequencer will write to RunOnce so that once you login again the process will resume;

HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce

Manual resume

Try this;

C:\Program Files\Microsoft Application Virtualization\Sequencer\Sequencer.exe /resume

However, it did fail the first time … Why would it work the second time?

What could cause this?

My assumption would be that any type of process that would interrupt the sequencer to properly shutdown its business in Scratch or properly open it would of course interfere the process.

If there is a GPO that would clear out the temp-folder, very common within RDS environments, that could potentially cause issues (as the serialized state will be lost).
I have heard a rumour that redirect folders (such as My Documents, or AppData) might interfere.

App-V 5.0 SP2 (beta)–Client UI

If you have installed the App-V 5.0 SP2 beta Client which is available on Connect, the first you notice that there isn’t anything on the start-menu. In the initial release of App-V 5.0 there was both a tray icon and a shortcut directly on the users start-menu (well, if using Windows 7) to view the state of the client, however (unlike the previous 4.X version) there was also no way of getting rid of the system tray icon (and /or official way of not getting the start-menu shortcut, but you can just delete it without any harm).

In a technical community though, the workaround is not far away and after a while someone figured out that by renaming one of the executable files you would simply fail the systam tray icon to start.

Not a pretty way togo?

Well, in App-V 5.0 SP2 (beta) the UI seems to be completely gone. Actually – there isn’t any system tray icon and no start-menu shortcut. Obviously we have been hearing the PowerShell drum for a while – so did they go for the bold move and completely wiped the icon?

I can’t say that the system tray icon is around anymore, however the interface for users can still be found – as a virtual app!

Lets hope this is the start of an awesome trend, but yeah – why not provide the App-V Client user interface as a virtual application?

image

Add-AppvClientPackage -Path .\AppVClientUI.appv | Publish-AppvClientPackage
PackageId            : 237cb45b-20c7-4c91-985c-39a94507975a
VersionId            : f53d7a26-7fe3-40ab-990e-f244dc59ff43
Name                 : Microsoft App-V 5.0 Client UI
Version              : 0.0.0.1
Path                 : C:\Users\\Desktop\AppVClientUI\AppVClientUI.appv
IsPublishedToUser    : True
UserPending          : False
IsPublishedGlobally  : False
GlobalPending        : False
InUse                : False
InUseByCurrentUser   : False
PackageSize          : 1241895
PercentLoaded        : 21
IsLoading            : False
HasAssetIntelligence : False

You can publish it globally or to a specific set of users. Anyway you like it!

Download the RTM-bits from Microsoft.

App-V 5 installation fails

When deploying the App-V Client at a customer site the installation failed (or halted was more like it). It seems that a few parameters caused issues and once reviewing the log-file it became apparent which. Last part of the log-file looked like this;

MSI (s) (68:78)  Executing op: CustomActionSchedule(Action=OptIntoMu,ActionType=3073,Source=BinaryData,Target=AppvPerformMUOptInInstall,)
MSI (s) (68:B4)  Invoking remote custom action. DLL: C:\Windows\Installer\MSI37CC.tmp, Entrypoint: AppvPerformMUOptInInstall
Fault injection has been disabled by policy.

The parameters set during the install (for App-V 5.0 SP1) was set like this;

/ACCEPTEULA=1 /ENABLEPACKAGESCRIPTS=1 /MUOPTIN=1 /CEIPOPTIN=1 /NORESTART /q

Toggling MUOPTIN to 0 resolved the issue – which is great. I am guessing that if updates are provided through Microsoft Update they will simply have to be deployed through normal software distribution.

App-V 5.0 SP2–AppvClientConfig

imageThere are a few new configuration settings that can be exposed via Get-AppVClientConfiguration. Looking at the output of the PowerShell cmdlet on the side we can spot four new in total;

PackageStoreAccessControl
EnablePublishingRefreshUX
ProcessesUsingVirtualComponents
EnableDynamicVirtualization

PackageStoreAccessControl can restrict users from browsing, and starting applications from, the PackageInstallationRoot to locate any published applications and gain access to something that was not intended for them.

EnablePublishingRefreshUX aims at providing a user interface, a progress bar, for the publishing refresh operation. Since the new architecture for App-V 5 has been put into production this is a topic that has surfaced that the publishing refresh is slower compared to App-V 4.X and interrupts the user. As part of improving that experience there are two changes – one is to provide the user with a visual indicator on how far along the progress is. The second part is that the start menu is only refreshed for every 5 applications that are published – to avoid it refreshing to often.

The Sync-AppVPublishingServer also has a –HideUI to give the option to not present the progress bar when performing a sync.

ProcessesUsingVirtualComponents is a new setting that seems to relate to the ability to provide the new shell extensions and the browser helper objects. Its not documented, but it seems to provide a list of processes that can access the virtual environment to utilize resources part of the package.

Sample value; ProcessesUsingVirtualComponents         {%SystemRoot%\explorer.exe, %Program…                                  

EnableDynamicVirtualization simple toggles the ability to use the virtual extensions on or off.

App-V 5.0 SP2–Shell Extensions

Since I first started looking at App-V (4.1) back in 2006 – there was one feature that has always been wished upon.

Right-click menus – aka shell extensions.

Aaron Parker has previously written a hack which could resolve this, but its not been widely used and requires a lot of work but does not provide all functionality. The initial idea came from VMware and howto leverage the MSI-file to “workaround” the issue

image

Why? Since day 1 – part of the App-V training has been to sequence a “simple” application. Such as WinZip, WinRar or any other common compression utility part of any standard desktop deployment. However, when deploying this in production a single topic always surfaced and gave App-V a bad reputation within all companies. Shell extensions were not supported as an extension. In essence – the knowledge the operating system had about any existence of a virtual application was shortcuts and file type associations. It has taken from 2006 and up until App-V 5.0 RTM in 2012 until this changed in anyway. App-V 5.0 introduced major feature changes in this area and this of course brought a lot of hope up.

This hope has now turned into reality.

I can not praise Microsoft enough to finally provide us with this feature request.

As you can see – both WinRar and Beyond Compare have been deployed to a client, and as soon as a right-click menu is presented with the options – the package is in use.

What do you need todo during sequencing to make this work? Nothing – it just works!

Finally – we can truly aim for that 100% virtualized applications scenario being in reach for any environment. Its not quite there, but it is not far away.

New extensions are;

ActiveX controls
Browser Helper Object
Context Menu Handler
Drag-and-drop Handler
Drop target handler
Data object Handler
Property sheet handler
Infotip handler
Column

App-V 5.0 SP2 – Visual C++

Since App-V 4.5 has been released into the wild there has been a couple of things I personally have been preaching to the community to get a high level of successful virtualized applications. One of these things is the deployment, and active updating of, Visual C++ Redistributable. All in all there is about 22 different versions to be deployed both onto any sequencing machine and any potential client. See the previous article Setup a VM for Packaging for a complete list that contains download links and in which order I install. them. Tim Mangan has gathered a more complete list that contains a lot more information about each and every version of the Visual C++ Redistributable. Now, this is all talk and no evidence that the native installation of all these different prerequisites will actually make life easier for anyone and perhaps just introduce a risk for us when deploying additional components natively.

I wrote a FAQ response on Aaron Parkers App-V 4.X FAQ regarding if you can virtualize VC Redist or .NET Framework – which conclusive says NO. In addition to the above generic response, I have personally dealt with SAP GUI (7.1 / 7.2), Adobe Photoshop CS6 (most likely applicable to all CS 6 software), Paint.NET, the error message 000036B1 and Autodesk Navisworks Freedom when it comes to recipes and specific error messages that all go back to missing Visual C++ Redistributable components as a root cause.

This is now a thing of the past.

App-V 5.0 SP2 changes this drastically as it will detect and virtualize all versions of Visual C++. In addition to this – the App-V 5.0 SP2 client will now detect VC++ Redist components part of packages produced in earlier versions of the App-V 5.0 sequencer and also allow those to be part of the virtual environment.

How does this work? It just works!

When you sequence a software, no “special” actions are necessary, no additional steps are required. Once you have completed the installation a report will inform you that the components are detected;

image

The details of the report looks like this. It tells us which components have been detected.

image

What does this mean for the previous written best practices?

It’s all in the trash

We can move back to a “lowest common denominator” for the Visual C++ Redistributable components and make sure that as much as possible are part of our packages. Stay tuned for an updated article on that!

One setting located under Options on the sequencer;

image

Identify App-V 5 errors

App-V 5 has provided us with many granular logs to identify issues, but when troubleshooting there needs to be an overview of errors. For the last few days quite a lot of effort on my own part has been in browsing through the logs, so as opposed to manually traverse individual logs or filtering all of them we can leverage PowerShell to identify errors quite easily. The below piece of code will traverse all but one of the logs and quickly identify any errors.

#Nicke Källén – 2013-05-08
#Define App-V logs
$appvlogs = Get-WinEvent -ListLog *AppV* -Force
#Define start-time - suggested time yesterday
$starttime = (Get-Date).AddDays(-1)
#Define end-time - now
$endtime=[datetime]::Today
#Set Culture to en-US, otherwise Message goes blank
$orgCulture = Get-Culture
[System.Threading.Thread]::CurrentThread.CurrentCulture = New-Object "System.Globalization.CultureInfo" "en-US"

#Loop through all log-files
foreach ($log in $appvlogs) {
write-host “Log; ” $log.LogName
#Skip operational log as it most contains informational messages and is heavy
if ($log.Logname -ne "Microsoft-AppV-Client/Operational") {
#Select only errors (level = 2) and select time and message of the event
Get-WinEvent -FilterHashTable @{Logname=$log.LogName;starttime=$starttime;endtime=$endtime} -Oldest -ErrorAction SilentlyContinue| ?{$_.Level -eq "2"} | Format-List TimeCreated, Message
}}
# Reset Culture to orginal
[System.Threading.Thread]::CurrentThread.CurrentCulture = $orgCulture

App-V 5; Enable or disable all debug-logs

Been diving into the App-V 5 logs for a few days and got tired of enabling the debug and analytic log files. Made a small sample to enable them in a loop;

Enable all App-V 5 logs;

##Nicke Källén 2013-05-08
##Enable all logs
$appvlogs = Get-WinEvent -ListLog *AppV* -force | Where-Object {$_.IsEnabled -eq $false}
foreach ($logitem in $appvlogs) {
     write-host “Log enabled: ” $logitem.LogName
     $logitem.IsEnabled = $true
     $logitem.SaveChanges()
}
##Disable all logs
$appvlogs = Get-WinEvent -ListLog *AppV* -force | Where-Object {$_.IsEnabled -eq $true}
foreach ($logitem in $appvlogs) {
if (($logitem.LogName -ne "Microsoft-AppV-Client/Admin") -or ($logitem.LogName -ne "Microsoft-AppV-Client/Operational") -or ($logitem.LogName -ne "Microsoft-AppV-Client/Virtual Applications"))
{
     write-host “Log Disabled: ” $logitem.LogName
     $logitem.IsEnabled = $false
     $logitem.SaveChanges()
}}

No error handling is available, this is just a quick start to avoid loads of clicking.

(2013-05-05 – Added the Where-object to avoid getting errors…)

App-V 5 and sequencing platform

Microsoft best practice states that you should match your sequencing platform to your target platform. App-V has always given us an extremely well working platform to avoid that and still does. However, we have a game changer; Extension Points

What are extension points? More integration into the operating system to allow users to use their virtual applications in a manner they expect that it should simply work.

Did you just pop-in a music CD (not really ?) and had the default media player virtualized?

In App-V 4.X that would cause an issue due to the fact that the operating system had no awareness that you had a media player. Autoplay was not a supported extension point within App-V 4.

image

As you can see there are several possible choices in the above list on what todo when an Audio CD is inserted. If the application is virtualized – in an App-V 4.X environment it would not be visible in the above list.

App-V 5 changed the game and extended the list to support this scenario and much more. However, there is a new found reason of actually doing what Microsoft has been telling us todo all along.

Your sequencing platform should match your target platform.

For Windows 7 64-bit, you should sequence on Windows 7 64-bit.

In App-V 5 this is even more valid as several extension points are not following along if you attempt to sequence on a 32-bit platform and deploy to a 64-bit platform.

App-V 5 Modify a shortcut

When you create a new package and deploy it, there usually are some things that might resurface after the initial testing of a package. Such details might be the placement and name of a shortcut.

If you open an existing package in the sequencer you have three options;

image

Select Update Application in Existing Package will present you with a stripped version of the sequencing wizard. Aiming for the Edit Package will head you straight to tab-based part of the wizard where we can review and edit the package on a more detailed level;

image

Ponder this image above for a few seconds and lets continue with the Add New Application option.

Selecting the Add New Application is the route of upgrading packages that I personally recommend. The reason are simple;

There are no options removed while performing the updated sequence.

The Edit Package route (obviously) takes us to the tab-based edit mode and doesn’t allow us to capture any additional installers.

What might havechanged in the App-V 5 sequencer as the ability to edit and alter shortcuts actually shows up in the Edit-mode after you have finished either Update Application in Existing Package or Add New Application and choose Customize. The below tabs can be seen. For some reason – Shortcuts and FTAs isn’t visible when selecting Edit, but for the rest of the possible routes the full view of tabs is visible.

image

There seems to be “light” Edit and “advanced” Edit. Advanced Edit seems to only be available by strolling along the two wizard-based routes, where as light Edit can be directly accessed when opening a package. Light Edit does not allow you to alter shortcuts and file type associations.