App-V 5.0 SP3 and remote SQL

As App-V 5.0 SP3 has been released it is not only the client that gotten an update, but the App-V Server components has gotten a fresh new installer for the first time since App-V 5.0 SP1.

If one is working in a locked down environment where the roles of server and databases are seperated, and databases might be located on a shared SQL-hotel that no ordinary administrator is allowed access to – the question that rises is how does one get the database up 2 speed?

According to the notes the only supported scenario is to run from the installer provided by App-V 5.0 SP3, and what that is can be debated, which no SQL admin would dream about.

If executing the appv_server_setup.exe with the switch /layout there will be a folder extracted named database scripts.

Looking at the contents (in databasescripts) in App-V 5.0 SP3 and comparing that to the contents of App-V 5.0 SP1 – the files look fairly much the same;

image

When comparing the contents of the files the following differences emerge;

Createtables.sql


CREATE TABLE dbo.PackageGroupMembers (
Id                              int PRIMARY KEY IDENTITY,
PackageGroupId                  int NOT NULL,
PackageVersionId                int NOT NULL,
LoadOrder                       int NOT NULL,
<em>PackageOptional                    bit NOT NULL DEFAULT 0,
VersionOptional                    bit NOT NULL DEFAULT 0</em>
)

CREATE TABLE dbo.SchemaVersion (
Version                       int NOT NULL
)

InsertVersionInfo.sql


SELECT @minserviceversion = N'5.0.10107.0'
SELECT @dbversion  = N'5.0.10107.0'

And finally, looking at updates.sql – you can notice that there are some major changes. For example;

to begin with;


-- Replace SchemaChanges table with SchemaVersion table
RAISERROR('Removing SchemaChanges table', 0, 1) WITH NOWAIT
GO
IF (EXISTS (SELECT * FROM [INFORMATION_SCHEMA].[TABLES] WHERE [TABLE_NAME] = 'SchemaChanges'))
BEGIN
DROP TABLE [SchemaChanges]
INSERT INTO [SchemaVersion] VALUES (1)
END
GO

and continue with;


-- Add PackageOptional and VersionOptional columns to PackageGroupMemebers table
ALTER TABLE PackageGroupMembers ADD PackageOptional bit NOT NULL DEFAULT 0, VersionOptional bit NOT NULL DEFAULT 0

and


-- Erase the current schema version from the SchemaVersion table (the new current version will be written during the install)
RAISERROR('Removing current schema version', 0, 1) WITH NOWAIT
GO
DELETE FROM [SchemaVersion]
GO

It seems that all the changes to the database are actually contained in updates.sql and createtables.sql.

It seems that the below commands are suffice. All of this is just gathered information from the Microsoft provided scripts on howto setup a clean database.


CREATE TABLE dbo.SchemaVersion (
Version                       int NOT NULL
)

INSERT INTO [SchemaVersion] VALUES (1)

-- Add PackageOptional and VersionOptional columns to PackageGroupMemebers table
ALTER TABLE PackageGroupMembers ADD PackageOptional bit NOT NULL DEFAULT 0, VersionOptional bit NOT NULL DEFAULT 0
-- Update SchemaVersion table to version 2
DELETE FROM [SchemaVersion]
INSERT INTO [SchemaVersion] VALUES (2)

DELETE FROM [SchemaVersion]

Once this is completed, head on over to your App-V Management Server. install the .NET Framework 4.5.1

Then install the new App-V 5.0 SP3 bits – first the Management Server. Then the Publishing server. After that you are all done!

You can verify that your servers are operational by simply accessing their respective website. if anything odd shows up – check the event logs under Microsoft\App-V

App-V 5, ConfigMgr compliance and fixes

App-V 5 has recently gotten hit by two odd behaviors relating to an update and .NET Framework 4.5.2.

KB2984972 was released as an update for RDC, and caused some havoc both for App-V 4 and App-V 5. The workaround is documented in the article and essentially allows anyone to remove the unfortunate end-user experience by adding some registry keys.

.NET Framework 4.5.2 was released and quite early on people started noticing that a freeze could be experienced when using certain App-V applications. The culprit seems to be the processes wisptis.exe, and the issue could temporarily be worked around by terminating the process.

App-V 5 got hit by two issues that both were resolved by adding registry keys under the registry key ObjExclusions. The Gladiator has written an article that details more about this registry key, the purpose of it and the effects of it. The article is focused on App-V 4, however the knowledge and concepts still apply to App-V 5.

Under (HKLM\Software\Microsoft\AppV\Subsystem\ObjExclusions) this registry key there are a lot of registry keys starting at 1 and going upwards. Each registry key contains a value (oh, really?) that is the name of an object that is not virtualized.  Anyone can append new values by using the next available number. Aaron Parker wrote a great article on howto leverage Group Policy to add the requested registry keys to resolve the issues for KB2984972.

Let’s detail the fun fact about this registry key;

There are in a default installation of App-V registry keys from 1-92. On any given default installation the next available number we can use is 93. We now have two issues and would therefore end up with two extra registry keys (93 and 94). My guess is that Microsoft might potentially include these two above recommended registry keys in a future installation of App-V when a new version comes out. Forcing these values to be added to a specific number in the series could potentially throw other valuable exclusions out the window…

Therefore I personally voted against Group Policy (Preferences) and decided to go the route of ConfigMgr Compliance Settings.

By creating a configuration item I can achieve the following;

Detect if the specific value is already in the list
Find the next available number to create a new registry key in
Append the value if it doesn’t already exist.

In the end, this is what I came up with;

appv_ci

Detect if the App-V client is installed;

appv_detection

Two checks for each specific registry key;

appv_check

Create a rule set that will allow for remediation;

appv_wsptis

Scripts part of the Configuration Item. This sample is from the fix for KB2984972.

Check:

$regKey = "HKLM:\SOFTWARE\Microsoft\AppV\Subsystem\ObjExclusions"
$p = Get-ItemProperty $regKey
$kb2984972 = $p.PSObject.Properties | where { $_.Name -match "[0-9]" -and $_.Value -eq "TermSrvReadyEvent" } | select-object -ExpandProperty Name -ErrorAction SilentlyContinue

if(($? -and ($kb2984972 -ne $null))) {
1
}
else {
-1
}

Remediation:

$regKey = "HKLM:\SOFTWARE\Microsoft\AppV\Subsystem\ObjExclusions"
$p = Get-ItemProperty $regKey
$topvalue = $p.PSObject.Properties | Where-Object { $_.Name -match "[0-9]" } | Sort-Object -Property Name -Descending | Select-Object -first 1 -ExpandProperty Name
$topvalue = 1 + $topvalue

Function New-RegistryKey([string]$key,[string]$Name,[string]$type,[string]$value)

{

#Split the registry path into its single keys and save

#them in an array, use \ as delimiter:

$subkeys = $key.split("\")

#Do this for all elements in the array:

foreach ($subkey in $subkeys)

{

#Extend $currentkey with the current element of

#the array:

$currentkey += ($subkey + '\')

#Check if $currentkey already exists in the registry

if (!(Test-Path $currentkey))

{

#If no, create it and send Powershell output

#to null (don't show it)

New-Item -Type String $currentkey | Out-Null

}

}

#Set (or change if alreday exists) the value for $currentkey

Set-ItemProperty $CurrentKey $Name -value $Value -type $type

}

New-RegistryKey $regkey $topvalue "String" "TermSrvReadyEvent"

As a final treat. Here is the Configuration Item – ready to be imported into ConfigMgr.

 

2014-12-07 – Sebastian Gern stated an additional registry key for WISPTIS. The Configuration Item is also updated with the new settings.

AVE: Scripting

This is just some details that showed themselves while using AVE to insert a script for an App-V 5 package.

You can choose to insert the script directly into the package, or to a configuration file.

image

When configuring the script you can easily choose the context of the script, the triggers and howto await the completion of the script.

image

Triggers for machine context are;

image

For use context

image

The “Do not use encoded executable paths” simple toggles the usage of App-V tokens on / off.

image

Regardless if you toggle this on or off – the title will always use App-V tokens.

image

What scripts you have added are easily seen from the contents of the virtual package

image

Thats it! Somethings that just makes life easier…

Application Virtualization Explorer

Kalle Saunamäki is a reallly deep dive kind of guy. He knows a lot about the App-V 4 filesystem, the App-V 4 client and now he is digesting the App-V 5 client.

image

How does one notice this? Well, he is the creator of the most amazing App-V 4 / 5 editing tool. Anyone doing any type of packaging for App-V needs this tool.

Convert

Have you previously tried converting packages from App-V 4 to App-V 5? Seems really as the process is the following;

  1. Install the sequencer on a dedicated VM
  2. Run PowerShell cmdlets to spit out a new package
  3. Open the package to, and save the package again to get all new virtual extensions.

AVE does this in a much faster and easier way. Simply choose to Import the 4.X package, and then save it as a brand new package. This can happen on any workstation you are using, even if you have the App-V client installed!

image

Whats in my package?

Have you wondered exactly what a package contains? As the sequencer only reveals the VFS and registry (and sometimes the shortcuts and FTAs), quite often you resort to reading the DynamicConfig-files that are produced in XML – after you save the package. And even when reading the XML-files trying to understand what will get published on a client – there are quite a few entries missing (shell extensions and browser plugins as a sample).image

AVE will immediately make this visible and more to that!

Services

How about this great feature! Did a service you captured get left out? You can import it and directly insert into the package;

image

App-v and wisptis.exe

Some applications that are virtualized with App-V 5 have caused issues with wisptis.exe –  a process to handle the input of pen-enabled devices. image

Symptoms

When an application that uses a .NET Framework(WPF, silverlight, SCOM / SCCM console, App-V UI etc) 4.5.2 is virtualized on any version of the App-V 5 client there is severe mouse-lag or hang.

Reproduce the issue

Connect a device which uses the Tablet Input service – most commonly Wacom-devices. Any WPF application based on .NET Framework 4.5.2 can cause the issue – for example using Chrome to access Outlook Web Access and then pressing “New message” (will use Silverlight) to generate a new email will spawn the wisptis.exe. The mouse freezes. If the process (wisptis.exe) is terminated mouse responsive will return to normal. The below is the process start of wisptis.exe

Process 5836 starting at 000000013F5AD9C8 C:\Windows\System32\wisptis.exe 11:24:08.939: [6388/6532] NtTerminateProcess( ProcessHandle=0x4f8, ExitStatus=0xc000042c ) => 0

The attempt to start this process fails with an STATUS_ELEVATION_REQUIRED code.

(credits to Paul Richards for the above info)

Public Workarounds

It seems that reverting back to .NET 4.5.1 has resolved the issue for quite a few people. If your application actually requires the .NET Framework 4.5.2 version that is of no use as a workaround. Installing the below hotfix may improve the issue aswell, however the successrate so far is low;

Mouse drawing is displayed incorrectly when the screen resolution is restored after a full-screen application stops on a Windows 7-based computer that has a multitouch screen installed

(while you are at it – apply this one aswell: Tablet PC Input Panel cannot be moved after you install update 2973201 in Windows 7 or Windows Vista )

Obvious workarounds

WISPTIS.exe is a process to handle the pen input, and therefore we can reduce our impact by completely disabling the the functionality. The policy can be find under;

User Configuration – Administrative Templates – Windows Components – Tablet PC – Cursor image

You can also disable it as a service (applicable on Windows 7 – named “Touch Keyboard and Handwriting Panel Service” for Windows 8): image

I haven’t personally confirmed this and so far this seems extremely intrusive as it completely disables the functionality for all applications.

Community discussed workarounds

WPF uses an interface, documented on MSDN, to determine if this is a tablet / touch enabled device. If you, inside the App-V 5 package while sequencing, edit the following registry key;

HKEY_CLASSES_ROOT\Interface\{C247F616-BBEB-406A-AED3-F75E656599AE}

Change the default value (to something else), and then set it to Override Local. image

This obviously breaks the input functionality, however only for the virtualized application.

(Thanks Paul Richards for the above suggestion – brilliant in so many ways)

Microsoft Support Solution – 2014-10-15

This is the Microsoft suggested solution. Apparently App-V makes an attempt to start a second process, and therefore the lag is experienced. Create the following registry key on the App-V client machine. Location:“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppV\Subsystem\ObjExclusions” Type:       Reg_SZ
Name:     93
Value:     {773F1B9A-35B9-4E95-83A0-A210F2DE3B37}-running

The number 93 is used in this because 93 is the first available number in a default installation. This might be higher if your installation has more object exclusions.

Thanks Paul Richards for the update

Long-term resolution

Microsoft has released an informal article (Sebastian Gernert posted it), and as a far as we can see the recommended changes are available in App-V 5.0 SP3

Interesting topic

If you are a heavy user of Wacom hardware – see this guide of Vizibler that hopefully can improve your situation.

WMI Hotfixes for Windows 7 x64

##################################################
WMI
##################################################
You cannot overwrite an exported event log file by using the Wevtutil.exe tool in Windows 7, Windows Server 2008 R2, Windows 8, and Windows Server 2012
http://support.microsoft.com/kb/2797789/en-us
Files Updated:
Wevtsvc.dll
6.1.7601.22213
1,650,176
09-Jan-2013

Profile loading takes a long time due to full DFS namespace sync with PDC
http://support.microsoft.com/kb/2915094/en-us

Files Updated:
Profprov.dll
6.1.7601.22575
33,792
18-Jan-2014

Profsvc.dll
6.1.7601.22575
225,280
18-Jan-2014

Profsvc.ptxml
Not applicable
648
13-Jul-2009

Userprofilewmiprovider.mof
Not applicable
10,708
13-Jul-2009

High memory usage by the Svchost.exe process after you install Windows Management Framework 3.0 on a Windows-based computer
http://support.microsoft.com/kb/2889748
Files Updated:
Wmidcprv.dll
6.2.9200.16398
180,736
04-Jul-2013

Wmiprvsd.dll
6.2.9200.16706
724,992
26-Sep-2013

Wmiprvse.exe
6.2.9200.16398
432,128
04-Jul-2013

Wmidcprv.dll
6.2.9200.16398
180,736
09-Jul-2013

Wmiprvsd.dll
6.2.9200.20813
724,992
26-Sep-2013

Wmiprvse.exe
6.2.9200.16398
432,128
09-Jul-2013

Wmidcprv.dll
6.2.9200.16398
129,536
26-Sep-2013

Wmiprvse.exe
6.2.9200.16398
328,704
26-Sep-2013

Wmidcprv.dll
6.2.9200.16398
129,536
26-Sep-2013

Wmiprvse.exe
6.2.9200.16398
328,704

An update that prevents a “0xC0000034” error message when you try to install Windows 7 SP1, Windows Server 2008 R2 SP1, or Windows Embedded Standard 7 SP1 is available
http://support.microsoft.com/kb/2533552/en-us
Alot of files are updated

Forwarded events cannot be displayed in Event Viewer on a Windows 7 or Windows Server 2008 R2-based computer
http://support.microsoft.com/kb/2794427/en-us
Files Updated:
Wevtsvc.dll
6.1.7601.22213
1,650,176
09-Jan-2013

Wmiprvse.exe process crashes when you run a WMI script on a computer that is running Windows 7 or Windows Server 2008 R2
http://support.microsoft.com/kb/2833001/en-us
Files Updated:
Cimwin32.dll
6.1.7601.22296
2,059,264
10-Apr-2013

Unexpectedly slow startup or logon process in Windows Server 2008 R2 or in Windows 7
http://support.microsoft.com/kb/2617858
Files Updated:
Repdrvfs.dll
6.1.7601.21824
453,632
21-Sep-2011

An application or service that queries information about a failover cluster by using the WMI provider may experience low performance or a time-out exception
http://support.microsoft.com/kb/974930
Files Updated:
Clussvc.exe
6.1.7600.20517
4,579,840
28-Aug-2009

Cluswmi.dll
6.1.7600.20517
540,160
28-Aug-2009

Cluswmi.mof
Not Applicable
76,540
28-Aug-2009

Cluswmiuninstall.mof
Not Applicable
176
13-Jul-2009

Windows Installer Source Management

As part of ensuring that installations work “OK” if initiating a repair regardless of how many servers are terminated or ConfigMgr caches are deleted – here comes a summary of the feature.

Whats the purpose of this feature?

To ensure that the source-files for any MSI-based installation is available, even if they are removed from ConfigMgr cache or a single / multiple DPs are terminated.

How do you use this feature?

For each deployment type, you can configure the ProductCode that ConfigMgr will track;

clip_image001

Select the MSI-file part of the source-files by clicking Browse (the one in the red square). The file you select should (as you might guess…) be part of the deployment types content.

I realize that some installers are less than ideal for this feature. Any standard MSI will work out of the box, however if the MSI is embedded within an executable, or if the installation is multiple MSIs – this feature may not be a perfect fit. You can of course test it, or bring it up for discussion with everyone.

What happens at the client, when I do this?

Any client which has the software made available / forced to it will have the source updated on the fly. You can trigger the action to update the source-location manually by using this action;

clip_image002

The source-location to the closest DP will be appended to the Source-list for any managed application. Do note that nothing is changed in Net and Media. Only URL is appended. Original source-location will be intact – regardless if files are still there or not.

image

How do I troubleshoot this?

All actions are logged here;

SrcUpdateMgr.log

Sample output;

Adding install source C:\WINDOWS\ccmcache\5d\ to source list for product {1AD1DCA6-73FE-4803-858C-3441DF875BC1}            SrcUpdateMgr   2014-05-01 23:01:38       5944 (0x1738)

UpdateURLWithTransportSettings(): OLD URL – http://server/sms_dp_smspkg$/content_b0bd89d3-1cfb-4348-97bf-590f75672d0c.1            SrcUpdateMgr   2014-05-01 23:01:38       5944 (0x1738)

UpdateURLWithTransportSettings(): NEW URL – http://SERVER/sms_dp_smspkg$/content_b0bd89d3-1cfb-4348-97bf-590f75672d0c.1            SrcUpdateMgr   2014-05-01 23:01:38       5944 (0x1738)

Added source http://server/sms_dp_smspkg$/content_b0bd89d3-1cfb-4348-97bf-590f75672d0c.1 from local dps to source list for product {1AD1DCA6-73FE-4803-858C-3441DF875BC1}   SrcUpdateMgr   2014-05-01 23:01:38            5944 (0x1738)

UpdateURLWithTransportSettings(): OLD URL – http://server/sms_dp_smspkg$/content_b0bd89d3-1cfb-4348-97bf-590f75672d0c.1            SrcUpdateMgr   2014-05-01 23:01:38       5944 (0x1738)

UpdateURLWithTransportSettings(): NEW URL – http://server/sms_dp_smspkg$/content_b0bd89d3-1cfb-4348-97bf-590f75672d0c.1            SrcUpdateMgr   2014-05-01 23:01:38       5944 (0x1738)

Added source http://SERVER/sms_dp_smspkg$/content_b0bd89d3-1cfb-4348-97bf-590f75672d0c.1 from local dps to source list for product {1AD1DCA6-73FE-4803-858C-3441DF875BC1}   SrcUpdateMgr   2014-05-01 23:01:38            5944 (0x1738)

Successfully updated source list for product {1AD1DCA6-73FE-4803-858C-3441DF875BC1}         SrcUpdateMgr   2014-05-01 23:01:38            5944 (0x1738)

Prerequisites;

Ensure that the software is available for the device.
Pre-requisites for Windows 7 (pre-SP1) clients; KB2619572

The following registry key:

HKLM\Software\Policies\Microsoft\Windows\Installer
Name: WinHttpAutoLogonLevel
Type: REG_SZ
Value: L

Never ending reboot prompts

A few servers had continue to request, through the ConfigMgr, a reboot after the servers were, surprise, rebooted due to Windows Updates.

Use the below PS code you can see the current state of the reboot.

Invoke-WmiMethod -Namespace “ROOT\ccm\ClientSDK” -Class CCM_ClientUtilities -Name DetermineIfRebootPending -ComputerName <name>

Obviously, before actually doing any of the below suggestions – a restart should before forced on the client. On the servers in question, a minimum of one reboot per server has been confirmed before using this workaround.

The WMI method apparently only retrieves the current value of the ConfigMgr-client. To change the state of the WMI method –  one has to digest the registry a bit;

clip_image001

The current state is saved in HKLM\Software\Microsoft\SMS\Mobile Client\Reboot Management\RebootData

On a server rename it to old, and then restarted the CCMEXEC-service.

To confirm that a request for a reboot you can either await the GUI initialization, or use the above PS code to verify the pending reboot state.

All Reboot requests are logged in RebootCoordinator.log in the ConfigMgr client log-folder.

Some interest articles;

http://blog.thesysadmins.co.uk/sccm-2012-stopping-your-computer-is-about-to-restart.html

http://blogs.technet.com/b/umairkhan/archive/2014/06/10/configmgr-client-reboot-internals-for-update-deployments.aspx

http://blogs.technet.com/b/heyscriptingguy/archive/2013/06/10/determine-pending-reboot-status-powershell-style-part-1.aspx

ConfigMgr Client installation failure

Two odd failures from the ConfigMgr client that caused some headaches.

StatusAgentProxy.dll fails to register.

Verify that MSVCR100.DLL in c:\windows\system32 (yes, on a 64-bit system aswell) is the correct size.The renamed file (MSVCR100old.dll) shows the size of 755kb – which most likely is installed by a 3-party application and in error replaced the correct version of the file. As you can see, both files have the same version number.

clip_image002

 

CcmRegisterPerfCounter fails with an unexpected error.

The custom action is intended to register the Performance Counters for ConfigMgr client. Basically it needs two files in c:\windows\system32 (ccmframework.h and ccmframework.ini), a few registry keys and then it can set it up. Performance Counters seems to be very stable so only a 3-party application can actually cause any havoc here. To resolve this perform the following;

Open MSCONFIG. Select the Startup-tab and click disable all.

clip_image002[5]

Select the Services-tab. Select to hide all Microsoft-services and then click the Disable all.

clip_image002[7]

Restart the computer, and verify that the installation will complete.