W32TM commands

I ran into a recurring issue in one of the data centers I help administer.

For some reason the hypervisor was overriding the Windows Time domain hierarchy by setting it to sync with the local CMOS instead of the Primary Domain Controller… Every reboot resulted in it being reset to UTC time. The VM option to sync with the host wasn’t enabled (or not easily changeable with this particular hypervisor).

Anyways, I hope this is finally put to bed.

These are the commands I used the most for troubleshooting:

w32tm /query /peers
w32tm /query /status
w32tm /query /configuration
w32tm /query /source

I configured the PDC to sync to external sources and made sure it was set to be a reliable source.
Example NTP peer list for a PDC:

w32tm /config /manualpeerlist:”0.us.pool.ntp.org 1.us.pool.ntp.org 2.us.pool.ntp.org 3.us.pool.ntp.org” /syncfromflags:manual /reliable:YES /update
w32tm /config /update
Restart the Windows Time service
Verify it is syncing using the commands above

Set the other domain controllers to use the domain hierarchy:

w32tm /config /syncfromflags:domhier /update
restart the Windows Time service

If you have the above properly configure and they still are not syncing via NT5DS domain hierarchy (like in my situation), you can wave the red flag and force it via GPO:

Computer Configuration \ Policies \ Admin Templates \ System \ Windows Time Service \ Time Providers \ Configure Windows NTP Client

NtpServer: enter your domain controllers  (DC1,0x9 DC2,0x9) separating each one with a space
Type: NT5DS

Link this GPO to the OUs containing your Workstations, Servers, etc. Just don’t link it to your Domain Controllers OU so they use the the configurations we used above. You can even create a GPO for the Domain Controllers if you so desire, but I won’t get into that here.

After performing the above, the Time on the servers started behaving they way you would expect on a Windows domain. Hopefully this helps someone else.

An honorable mention that I found along the way:

Reg key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
DWORD: RealTimeIsUniversal
Value: 0x1

This allowed the time and timezone to persist between reboots, but we were still syncing time with the CMOS. We wanted to sync with our domain controllers. If your goal is to sync with the BIOS of the physical host and have your time changes persist between power cycling, this is for you.

Blue Screen of Death Registry Corruption 0x00000051

Haven’t posted in a while… This issue really bothered me. Such a simple fix that took so long to find.

I found this solution on Alex’s IT Blog here.

We had a Windows Server 2008 R2 Terminal Server recently have an issue where it had a BSOD everytime a user logged in. No one had recently installed any applications, updates, or made any major changes to the OS. We had plenty of backups that we restored that exhibited the same issue. The server booted properly and you could even manage it remotely without issue. Booting into Safe Mode and logging in worked fine as well. A memory dump said services.exe was to blame and something in the registry was corrupt.

Resolution:
Manually set Windows to use LastKnownGood Configuration in the registry (since the startup options do not present this any longer).
Steps to do this: 
Boot your failed server into Safe Mode
Launch regedit
Browse to: HKEY_LOCAL_MACHINE\SYSTEM\Select
Change LastKnownGood to 3
Change Failed to 2
Reboot
Log in and see if your server is functional again

Update to Sequence Like a Boss – BriForum 2015 Denver

An update to my Sequence Like a Boss presentation from BriForum 2015 Denver.

I attended Tim & Patrick’s session titled “5,4, 3, 2, 1, LIFTOFF! How Processes Become Virtualized” and learned that Acrobat DC is officially supported with App-V! In my session I mentioned that Adobe did not support Acrobat being sequenced in App-V. While that was true when I made my slides, it turns out they started supporting App-V 5 SP3 around a week ago. I do not believe they officially support older versions of Acrobat, but starting with DC is a big step.

Admin Guide/Recipe and more here: App-V Deployment: Acrobat DC

The Admin guide also mentions they have a separate MSI to enable “all” features of Acrobat.

To leverage all of Acrobat’s features, a supplementary App-V MSI must be installed on the user’s machine. The MSI should be available as a part of the downloaded .zip file. It contains Adobe Acrobat’s integration points for various applications such as:

  • MS Office Integration – Context Menu and In-App Acrobat Ribbons.

  • Mails Integration – MS Outlook and Lotus Notes will start showing Acrobat Features.

  • Adobe PDF Printer – Allows the user to print any file to Adobe PDF.

  • Web Capture – Allows the user to be able to convert a webpage to Adobe PDF inside the Browser.

  • Registers necessary fonts on the client which will be used by the virtual application.

I haven’t had time to go through the guide, but this is great news in the App-V community. Big thanks to Tim for mentioning that in his presentation.

Catch me at BriForum 2015 in Denver

I have the honor to be presenting at BriForum again this year! On top of that I will be presenting in two sessions:

Sequence Like a Boss – Presented by myself and co-presentor Drew Walz

In a continuation of the popular Sequencing for Success series, learn how to Sequence like a Boss. Just because an application doesn’t work at first pass doesn’t mean it can’t be virtualized. In this session, you will discover how shims and symbolic links can improve application compatibility. Learn how to identify the files and folders that need them. Find out how to use the same tools to troubleshoot application errors once an application has been virtualized.

Can’t Fix Your Application Issue? Try to Break it Instead!  – Presented by Drew Walz and me as the co-presentor.

Sometimes knowing how to break a Windows application can be the best way to determine how to fix it. “Break-it” triage can help you quickly identify the general category of what’s causing the problem with an app, and suggest acceptable short term workarounds. Deep-dive application troubleshooting tools and practices are great, but they require time, effort, and focus to use. In a customer outage situation, you’ll typically need to find a fix more rapidly. We’ll cover quick application troubleshooting triage tactics and workflows that will help you zero in on the source of the problem.

Register for BriForum Denver and find other great sessions at http://briforum.com/US/

BriForum 2014 video – Sequencing for Success

The BriForum 2014 videos are now publicly available! Catch the presentation that Rory and I did here: http://www.brianmadden.com/blogs/videos/archive/2014/08/05/briforum-2014-boston-rory-monaghan-amp-ryan-will-sequencing-for-success.aspx

Also, I will be presenting at Briforum 2015 twice this year! Be sure to catch my session ‘Sequence like a boss’ and I’ll be co-presenting with Drew Walz in ‘Can’t fix your application issue?  Try to break it instead!’

Creating shims with the Microsoft Application Compatibility Toolkit

I promised a while back to post some examples of creating and using shims. These are a little later than I wanted them to be, but here we are (finally). Since it took so long I added a bonus that I wasn’t able to include in my BriForum 2014 presentation, a video demonstration of the VIrtualRegistry shim.

My top 2 used shims:

  • CorrectFilePaths – These are similar to symbolic links, but are defined per .EXE instead of system wide
  • VirtualRegistry – Redirect registry calls. Can redirect HKLM to HKCU.

For a more detailed explanation on these, visit my previous post on shims.

Formatting your parameters:

CorrectFilePaths –

“original path”;”newpath”

Example:”C:\Programdata\Application X”;”Z:\ApplicationStore\Application X”

This will redirect the application call from the Programdata location to the Z drive. The Z could be a user mapped drive or any location you would prefer it go to. Keeping in mind that only the EXE(s) that you specify will only be redirected.

If you want to use environment variables such as %appdata%, I found that putting them at the begging of the parameter did not work. So I had to use “c:\users\%username%\appdata\roaming”.

Video Example:

VirtualRegisty –

ADDREDIRECT(key_to_redirect_from^key_to_redirect_to)

Example: ADDREDIRECT(HKLM\Software\Application\Database^HKCU\Software\Application\Database)

This will redirect the application whenever it calls the above HKLM key to the HKCU specified in the example.

Video example:

Download the Microsoft Application Compatibility Toolkit (ACT) here

How to generate a ConfigurationFile.ini for SQL Express

Creating a ConfigurationFile.ini for SQL Standard or Enterprise is easy. The installer automatically creates one for you and gives you the path at the ‘Ready to Install’ step. For some reason this default functionality for Express was removed starting with SQL 2008 R2 and continues to SQL 2012. I haven’t messed with SQL 2014 Express, but one might assume it’s gone there as well.

Anyways, getting the installer to generate a ConfigurationFile.ini is pretty easy. Open a command prompt and add the following parameters to the .exe:

/ACTION=INSTALL /UIMODE=Normal

SQL_NormalUI

Note that /Action is a required parameter. Also, setting /UImode to Normal will present every dialog box that exists in the installer (even ones that do not apply to Express). Normal is the default value for non-express editions.

A few things to know for your ConfigurationFile.ini

  • Add the following to the bottom of your file to agree to the license agreement: IACCEPTSQLSERVERLICENSETERMS=”True”
  • If you want to run in Mixed mode and need to specify the SA password, add the following to bottom of the file: SAPWD=”ENTER_YOUR_PASSWORD”
  • To perform an unattended or silent install modify QUIET=”False” to “True”
  • For a silent install you will need to comment out or remove UIMODE=”Normal” in the file. This cannot be used in a silent install

Source: Installing SQL Server from the Command Prompt

Update 10/26/16: In the comments, Stephan states that his SQL 2014 install would not accept TRUE/FALSE for the IACCEPTSQLSERVERLICENSETERMS. Try using 1 instead of TRUE if you experience the same error. I recently created a config file for 2014 and was able to use TRUE. FYI in case you do though!

App-V 5 SP2 and Crystal Reports Runtime 13

I recently ran into an issue sequencing an application that uses the Crystal Reports runtime 13. The application worked properly when natively installed on a machine, but thew errors when it was virtualized with App-V 5. It complained about a particular GUID and not being able to locate some DLLs.

I found a similar issue on the TechNet forums where an application that used Crystal runtime 13 worked properly in App-V 5.0 RTM, but not with SP2+. It appears Microsoft fixed some issues with buffering in the updated Service Pack. Which in turn ‘broke’ crystal integration with the application. I checked out the installation path for the Crystal runtime and it sure has some long paths!

C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\Crystal Reports 2011\crystalreportviewers

C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86

The OP of that issue was able to resolve it by creating an MST to shorten the file and registry paths. I was curious if I could fix this issue without creating an MST. I couldn’t find any install parameters for the runtime, but found ones for full-blown Crystal. The one I wanted was this:

CR_InstallDir

After confirming the same parameter worked with the runtime installer, I set installdir to – C:\Program Files (x86)\1\

This changed the installation directory to: C:\Program Files (x86)\1\Crystal Reports for .NET Framework 4.0\Common\..

It only saved 18 characters, but it might just do the trick…. And it did! Now the application is able to run reports without error.

The underlying issue here is that installation path is too long when you sequence it. Maybe the next verison of the Crystal runtime will have shorter paths…. If not, we should at least have a work around.

Here’s a bonus! – I hard a hard time locating a download page for the runtime, but I found it here.

Two particularly useful Shims

As promised in my BriForum 2014 session, I will start a small series on Application fixes using shims and symbolic links. The first installment is on shims:

Shims can be really useful in just about any environment and I wish there were some better resources explaining how to use them. This is why I wrote this article explaining my two favorite shims.

As Microsoft releases new versions of their OS, folder structures and other key areas are bound to change. Or some applications may store personal user settings in a shared location or has a registry key that is best lived in HKCU instead of HKLM. This is where shimming or “Compatibility Fixes” come to the rescue.
A shim is installed at the system level and will essentially intercept an application call and change the default behavior of the application. The two main flavors of shims that I find extremely useful are CorrectFilePaths and VirtualRegistry. There are several hundred types of shims, but these two are the ones I find myself using a lot.

CorrectFilePaths
This shim is particularly useful when an application stores a file or folder in a directory that you want stored somewhere else. For example, say you install an application on an RDS server that stores a configuration file in ProgramData. This is not a good location if each user writes settings to it and get overwritten by other users. The CorrectFilePaths shim allows you to redirect the file call from the original path (e.g. C:\ProgramData\ABC Inc\UserConfig.ini) and replace it with a path that is user specific (e.g. %appdata%\ABC Inc\UserConfig.ini).

During shim creation you specify what process will be intercepted and redirected. This way when a user launches the process you specified and calls the file, it will be redirected to the new location. Now every user will have their own configuration file instead that doesn’t conflict with other users.

VirtualRegistry
Much like CorrectFilePaths, the VirtualRegistry shim allows you to redirect a registry call to a different location. An example where this would be useful is when an application stores a database server value in HKLM. This value may tell the application what server to establish a connection to. Now, say you have two groups of users – Group A & Group B. Group A connects to database server 1 and Group B connects to database server 2. Normally you would build a separate RDS server for each group to accommodate the multiple database values, but what if you wanted to have both user groups use the same server? How would you be able to accommodate that?

Create a new VirtualRegistry shim! You can redirect the HKLM values to HKCU and set those values with a logon script. This way Group A gets its registry key for database server 1 and Group B gets theirs for database server 2.

Shims sound great and they really are, but they can be a pain in the rear to get configured. I’ll post an article on both shims with examples in a few days.

If you want to get started Shimming, download the Application Compatibility toolkit from Microsoft here: http://go.microsoft.com/fwlink/p/?linkid=205020