Friday, July 03, 2015

AppV5 - Sequencing first steps

I follow a specific pattern when sequencing my applications.  I'm going to put the same first steps for every application I sequence here.

1) Open the 'Microsoft Application Virtualization Sequencer' and select the menu 'File' then 'Load Template...'

2) Browse to and select your template.

3) Click OK

4) Click 'Create a New Virtual Application Package'

5) Click 'Next'

6) Click 'Next'

7) Choose 'Standard Application' and click 'Next'


Thursday, July 02, 2015

Setting up a PVS AppV5 sequencer

A typical workflow for sequencing an application is something like this:
1) Take a snapshot of your sequencer (odds are it's a virtual machine [VM])
2) Power up your sequencer and sequence your application
3) Move your application to your system, test it, try and catalog all problems.  Revert your VM snapshot and go to step 1.

In several environments that I have worked in, this is a bit of a hassle as most environments implement the 'Machine Account Password Expires after X days'.  So after that time you either need to delete your snapshot, power on your VM and rejoin domain then start over.  This gets really cumbersome with multiple sequencers to take care of.  In addition, at my current environment, we require Windows Update be up-to-date and applied to all machines, including sequencers.  Reverting a snapshot to before Windows Update will, sometimes, cause Windows Update to start upon the desktop when you login.  There is a lot of overhead and hassle to maintaining snapshots, though it is better than the alternative of reinstalling the operating system each time you want a clean sequencer.

There is a very elegant solution to all of this I have found that also allows me to sequence super fast.

Citrix Provisioning Service (PVS).



Citrix PVS works by managing the Active Directory machine account password for me, so I never have to reset it again.


With Citrix PVS you can create several sequencers from one vDisk.  This ensures consistency and avoids tech's having their own VM with their own nuances.


Citrix PVS allows you to create a version of the vDisk and apply Windows Update's.  Automatically, all of your sequencers get the updates applied.



With 'Standard Image' mode, the VM now becomes 'non-persistent'.  This means if you reboot your VM it will go back to the state it was when it was last powered on.  PVS requires a 'persistent' supplemental disk attached to the VM for things like the event log, page file and the write cache files.  We ensure the supplemental disk is large enough so we can locally store application installer files there (temporarily!) then the installer files go onto a fileshare that has regular backups, etc.

Starting with Citrix PVS 7.1 there is a new feature called 'Cache to device RAM with overflow on hard disk'.  By utilizing a memory sizing for your sequencer VM that can run the operating system *and* contain the largest application in total megabyte size, your sequencing can go super duper fast!  Sequencing to the operating system drive with this PVS feature will actually write to RAM, which is significantly faster than disk.  This shortens sequencing times significantly.  You will need to ensure your cache size is large enough for your largest application or else the overflow to disk will slow you down.

But won't this setup fail to work with AppV5's 'reboot' feature?


Starting with AppV5 you can now *reboot* an application in the middle of sequencing and the sequencer is supposed to be pickup after the reboot and continue to capture.  So far, I have not had good luck continuing sequencing after rebooting with the AppV5 sequencer.  I've found, with a 100% success rate *so far* that a reboot is not necessary.  I'm aware that applications like Chrome show that a reboot can make a package work successfully, but I prefer to figure out what it does post-reboot and just implement that in the sequence instead.

By avoiding doing reboots we are not missing that feature at all.  In cases where it is absolutely required
I have a workaround.  I create another vDisk version in Maintenance mode


And set my Sequencer VM to Maintenance mode.


This turns the VM to a 'persistent' state for this duration.  Once the sequence is completed I delete the version and set my VM back to production.  The caveat here is only one VM may use the maintenance version at a time.

What should I put on my PVS Sequencer?

As per my previous topic, I believe you should try and minimize the visual C++ runtimes that are different from your sequencer to your VDI/XenApp server boxes.  If possible, make them identical.  This prevents AppV5 from usurping installed versions of this runtimes when pushed to your VDI/XenApp servers.  They may still get usurped if an application has a different version installed then what you have on your box, but I strongly believe in minimizing it if possible.  There may also be a (small) benefit by speeding up your application first launch experience by removing some minor registry staging.

Here is what I have on my sequencer and a clipping of some of the software we run on our XenApp servers:

All of the software on the Sequencer

A small clipping of software on the XenApp servers

With the PVS sequencer you have a static, persistent disk that you can use to locally store installer files, notes, AppV template file, whatever you need to help you get sequencing.


A little snapshot of my persistent disk

How do I sequence with this thing?

For my sequences, I usually create a batch file that lets me do a silent install of the application and any shortcut configuration.  I can then use this batch file to do a completely scripted sequence if required in the future.  Otherwise, sequencing is identical to how you would do it previously, but you cannot restart the system!  Restarting will result in a clean sequencer coming back up (after all, that's the point!)


Wednesday, July 01, 2015

AppV5 - Be mindful of application integrations

When you sequence an application in AppV5 there are special keys that will be 'integrated natively' into your system.  These keys are HKLM\Software\Classes.  There are numerous things that can be integrated and these include things like File Associations or, even worse, libraries.  I believe a 'best practice' should be to make your sequencer and target platform as close as possible by installing the same software on both if you can.  For example, for all the Visual C++ native runtime libraries on your target device have that same software on your sequencer too.  If they differ than the natively installed package will be usurped by a AppV5 package's deployment.

AppV5 Package has usurped a natively installed control

The differences in the two files


This can cause issues if you are not careful about the deployments of your AppV packages as well as Windows will now natively use some libraries that may have security concerns.  This can also cause some issues if poorly written applications have specific version requirements and if multiple packages are installed with overlapping files/keys, it appears the last loaded package wins.

In one particular example I made an 'Internet Explorer' package that changed the registry keys within IE so it would identify itself as IE 6.  Doing this resulted in the http key being changed as well:


This resulted in every programatic launch of a URL to launch iexplore.exe within a different AppV bubble.  This was unexpected as I do Internet Explorer customizations within my packages so that when you launch IE you have the IE customizations for that app all with you.  This one package caused issues as http launches to went into this package as opposed to the package you were in when you launched it.

So, if you have a machine that loads multiple packages, be aware of these potential issues.

Friday, June 26, 2015

Crystal Reports 13 and AppV 5 have issues

Crystal Reports 13 and AppV 5 have issues.  Crystal Reports 13 (CR) installs to some long paths which fail when loaded AppV5 tries to 'integrate' them.  A blog detailed shortening the installdir path to something much shorter but CR still failed for me.  My path without modifying the INSTALLDIR property was:
C:\ProgramData\Microsoft\AppV\Client\Integration\14FA6B99-E7E2-4F5A-B7FC-4B024DE1705A\Root\VFS\ProgramFilesX86\SAP BusinessObects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64

224 Characters.

With the modified INSTALLDIR it was:
C:\ProgramData\Microsoft\AppV\Client\Integration\14FA6B99-E7E2-4F5A-B7FC-4B024DE1705A\Root\VFS\ProgramFilesX86\1\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64

206 Characters.

This still failed.

The symptoms were errors in the application:





'The type initializer for 'CrystalDecisions.CrystalReports.Engine.CRPE' threw an exception.

Attempting to register the DLL's related to these resulted in these errors:




[Window Title]
RegSvr32

[Content]
The module "clientdoc.dll" may not compatible with the version of Windows that you're running. Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe.

[OK]

Since AppV5 integrates HKCR keys natively into the system, if you can't register a DLL via a long path, then you will error with CR.



You can actually replicate a similar error by trying to 'install' CR with a long path, so it's not AppV5 that's at fault, but apparently something within the CR DLL's.  Trying to install to a path similar in length to the AppV5 path will fail:






So what is the maximum length CR can be installed to?



259 total characters.  At 260 characters or greater the installer fails with an error similar to the above. I'm not sure why the AppV5 path is significantly less, but it is for some reason.


In the end my path was:
D:\AppVData\PackageInstallationRoot\14FA6B99-E7E2-4F5A-B7FC-4B024DE1705A\05D9D6C9-B77A-4376-94C6-C13E4764A8B0\Root\VFS\ProgramFilesX86\1\C\Common\X\win64_x64\

158 Characters.

To do this I needed to modify the SAP Crystal Reports 13 file with a MST transform file.  I did it by doing this:

Step  
Action
1   1.

Copy the ScreenTest III installation source files to a temporary folder C:\swinst on the sequencing machine (WSAPVSEQ07 - Windows 2008 R2 SP1 in this case).

1   2.
Install Orca.msi
1   3.

Launch Orca and ‘Open’  the Crystal Reports version

1   4.
Choose Transform from the menu > ‘New Transform’
1   5.
Select ‘Directory’ and find the first instance of ‘CrystalR|Crystal Reports for .NET Framework 4.0’



1   6.
Double-click ‘CrystalR|Crystal Reports for .NET Framework 4.0’ and copy the field.  Select the menu ‘Edit’ > ‘Replace’ and set ‘Find what’ as ‘CrystalR|Crystal Reports for .NET Framework 4.0’ and ‘Replace with:’ as ‘CrystalR|C’



And click on ‘Replace All’.  If you get prompted:


Select ‘Yes’.
1   7.
Repeat the process for ‘SAPBusin|SAP BusinessObjects Enterprise XI 4.0’  to ‘SAPBusin|X’


1   8.
Select ‘Registry’ and sort by ‘Value’.  Find the first instance of [INSTALLDIR]


1   9.
Do a ‘Replace’ and enter ‘[INSTALLDIR]Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0’ for ‘Find what’ and ‘Replace with’ as ‘[INSTALLDIR]C\Common\X’

And click on ‘Replace All’
1   10.
Result:


1   11.
Select the menu ‘Transform’ > ‘Generate Transform’ and save the file as something like:

SAP_DIR_Short2.mst
1   12.
Select the menu ‘Transform’ > ‘Close Transform’ and exit out of Orca.

You can now install SAP CR with a command line similar to this:
msiexec.exe /i "CRRuntime_64bit_13_0_14.msi" TRANSFORMS=SAP_DIR_Short2.mst INSTALLDIR="C:\Program Files (x86)\1" /qb



Thursday, April 09, 2015

Install 64bit Windows OS (7+) on older 64bit Mac's (2007 32bit EFI white MacBook)

When working at HP I came up with a Windows Vista restore/install solution that worked using Windows PE for both 32bit and 64bit architectures.  A few years ago, I tried the same solution against my 2007 White MacBook, and, lo and behold, I was able to install 64bit Windows 7 on my MacBook.  I didn't have the time to document it as it was just for curiosity, but I am doing so here now because I am repurposing my MacBook as a 3D Printer server.

To start, you need a 32bit Windows install on DVD and the version of Windows you want to install on a USB key (or another DVD).  This is because the MacBook will not DVD boot off of a 64bit install, or the USB key.

1) Boot off the 32bit install DVD.

2) Shift-F10 into a command prompt.

3) Format your hard drive/partition.  Make sure you only have 1 partition.  You may need to use diskpart, whenever I used the Windows Setup it created 2 partitions which causes 0xc000000f errors on startup because the BCD file is configured to look for [boot]\path\to\wim which doesn't reside on the boot drive.



4)  Robocopy everything from the DVD to the HDD. (My DVD drive came up as E:)
Robocopy E:\ C:\ /MIR



5) Insert your Windows x64 USB/DVD and copy over *just* the install.wim from %USB%\sources\install.wim to your C:\sources\install.wim

6) Eject the DVD and reboot your computer off the hard drive.  Do the install as usual.

This trick only seems to work when you have both 32bit versions and 64bit versions of the SAME software.  It does not appear to work if you try, for instance, to use the Windows 7 Enterprise x86 and Windows 7 Ultimate x64.