Monday, February 15, 2016

MXA: Another specialized Windows Performance Tracing tool

Goodness knows I love a good Windows Performance Tracing exercise.

So imagine my delight when I spotted a new tool for doing just that – and one that is narrowly focused on tracing out audio/video playback issues!

Media eXperience Analyzer (MXA) is a visual performance analysis tool that enables engineers to optimize performance and quality of Media scenarios on Windows devices. MXA enables a broader range of performance engineers to infer meaningful information from a large amount discrete event data by representing events visually and providing powerful filtering capabilities. MXA is utilized to optimize quality, performance, and latency of the following scenarios:

    • Camera capture
    • Miracast & PlayTo
    • Energy efficiency for media
    • Audio & video playback & transcode
    • Real-time communications (Skype & Lync)
MXA is capable of loading traces collected on Windows, Windows Phone, and XBox. MXA assists with identifying delays and bottlenecks in the CPU, GPU, network, and disk and is primarily applied to:
    • Root causing audio and video glitches
    • Improving audio video synchronization
    • Correlating physical domain with software domain
    • Correlating power usage per component with system activity
    • Optimizing latency between Miracast source and sink devices
    • Optimizing devices for full screen video playback and low power audio
    • Verifying critical media threads are enlisted in Multimedia Class Scheduler Service (MMCSS)

How cool is that?!

To get a good understanding of the tool in action, Microsoft’s Channel 9 “Defrag Tools” has been running a series of sessions on it.

If you have worked with the Windows Performance Analysis Toolkit the interface and graphing should look pretty familiar.

Cheers!

--Claus Valca

Win 7 Task Image Corruption Errors: In which A Quick Fix is found and Blame is to be Assigned

When we last left the story, I had resolved a thorny issue getting a Glassware update to go on “clean” and re-attach to its service.

But subsequently I found on my Windows 7 (x64) Ultimate system that when I went into “Task Scheduler” via the Control Panel, I was getting this error:

2016-02-13 22_21_32-Task Scheduler

In total there were 46 different “tasks” that had that error message:

Task image corrupt: Dell SupportAssistAgent AutoUpdate
Task image corrupt: GoogleUpdateTaskMachineCore
Task image corrupt: GoogleUpdateTaskMachineUA
Task image corrupt: GoogleUpdateTaskUserS-1-5-21-1728537537-2011028439-759670610-1000Core
Task image corrupt: GoogleUpdateTaskUserS-1-5-21-1728537537-2011028439-759670610-1000UA
Task image corrupt: PCDEventLauncherTask
Task image corrupt: PCDoctorBackgroundMonitorTask
Task image corrupt: SamsungMagician
Task image corrupt: SystemToolsDailyTest
Task image corrupt: Microsoft\Office\Office Automatic Updates
Task image corrupt: Microsoft\Office\Office ClickToRun Service Monitor
Task image corrupt: Microsoft\Windows\Media Center\ActivateWindowsSearch
Task image corrupt: Microsoft\Windows\Media Center\ConfigureInternetTimeService
Task image corrupt: Microsoft\Windows\Media Center\DispatchRecoveryTasks
Task image corrupt: Microsoft\Windows\Media Center\ehDRMInit
Task image corrupt: Microsoft\Windows\Media Center\InstallPlayReady
Task image corrupt: Microsoft\Windows\Media Center\mcupdate
Task image corrupt: Microsoft\Windows\Media Center\mcupdate_scheduled
Task image corrupt: Microsoft\Windows\Media Center\MediaCenterRecoveryTask
Task image corrupt: Microsoft\Windows\Media Center\ObjectStoreRecoveryTask
Task image corrupt: Microsoft\Windows\Media Center\OCURActivate
Task image corrupt: Microsoft\Windows\Media Center\OCURDiscovery
Task image corrupt: Microsoft\Windows\Media Center\PBDADiscovery
Task image corrupt: Microsoft\Windows\Media Center\PBDADiscoveryW1
Task image corrupt: Microsoft\Windows\Media Center\PBDADiscoveryW2
Task image corrupt: Microsoft\Windows\Media Center\PvrRecoveryTask
Task image corrupt: Microsoft\Windows\Media Center\PvrScheduleTask
Task image corrupt: Microsoft\Windows\Media Center\RecordingRestart
Task image corrupt: Microsoft\Windows\Media Center\RegisterSearch
Task image corrupt: Microsoft\Windows\Media Center\ReindexSearchRoot
Task image corrupt: Microsoft\Windows\Media Center\SqlLiteRecoveryTask
Task image corrupt: Microsoft\Windows\Media Center\UpdateRecordPath
Task image corrupt: Microsoft\Windows\MobilePC\HotStart
Task image corrupt: Microsoft\Windows\MUI\Lpksetup
Task image corrupt: Microsoft\Windows\MUI\Mcbuilder
Task image corrupt: Microsoft\Windows\PerfTrack\BackgroundConfigSurveyor
Task image corrupt: Microsoft\Windows\RAC\RacTask
Task image corrupt: Microsoft\Windows\Shell\WindowsParentalControls
Task image corrupt: Microsoft\Windows\SideShow\AutoWake
Task image corrupt: Microsoft\Windows\SideShow\GadgetManager
Task image corrupt: Microsoft\Windows\SideShow\SessionAgent
Task image corrupt: Microsoft\Windows\SideShow\SystemDataProviders
Task image corrupt: Microsoft\Windows\Tcpip\IpAddressConflict1
Task image corrupt: Microsoft\Windows\Tcpip\IpAddressConflict2
Task image corrupt: Microsoft\Windows Live\SOXE\Extractor Definitions Update Task
Task image corrupt: OfficeSoftwareProtectionPlatform\SvcRestartTask

Oh my!  Did my Glasswire “repair” bork my system?  Did taking down the security perimeter allow an attack to penetrate?

Doubtful.  Once I clicked “OK” 46 times Task Scheduler would load and otherwise seemed OK. And the system would boot and run just fine. These errors were encountered only when loading up Task Scheduler.

Some initial research found these links:

That first link from Microsoft describes the manual repair process which is pretty painful…especially when you have a LOT of borked entries.

  1. Find the corrupted sub-key in the registry,
  2. Make a temporary copy of the corrupted task file
  3. Clean it up
    1. delete the task file
    2. delete the registry sub-key(s)
  4. Re-create the task by using the backed up copy

Luckily that last link in the Windows 7 Forums site had a recommendation for a quiet and obscure utility to help with the repair process…and explain just how these tasks got borked.

Repair Tasks – CodePlex project by Dijji

The Blame Game – Microsoft and my failed Windows 10 Upgrade/Rollback

Dijji explains exactly what happened on the main page…and it’s no surprise: my failed Windows 10 upgrade and rollback caused the issue.

In particular, it fixes problems where opening the Task Scheduler, or trying to configure Windows Backup, results in the message "The task image is corrupt or has been tampered with" (0x80041321).

Searching the web reveals that this message has been seen from time to time, and the (rather laborious) set of steps that can be taken to correct it are fairly well-documented (see here and script for it here).

However, it turns out that reverting to Windows 7 from Windows 10 generates this problem in spades. It can leave more than 40 scheduled tasks in a corrupt state (see this thread). This is because many task registry keys and the task definitions to which they refer are updated by a Windows 10 upgrade, but only the registry keys are restored on reversion, so Task Scheduler finds that, for these tasks, the task registry keys and task definitions are now inconsistent.

So basically, the Windows 10 upgrade adds a bunch of additional scheduled tasks to the system, but when you roll-back, they are not all removed. Then you get the errors.

Classy, Microsoft.

Dijji’s Repair Tasks Utility In Action

Fortunately, brilliant and clever community folks like Dijji are around to do the hard work and create solutions to mop up the mess left in isle 4.

After reading all of Dijji’s project documentation I went through the process and quickly had all my corrupted tasks restored, the ones I didn’t need removed, and Task Scheduler working normally again.

Repair Tasks is a brilliant kit of software.

First read this:  Repair Tasks – Documentation to get a deep dive into the problem and the steps the utility does in the repair process.

Then read this: Repair Tasks - Documentation - Windows 10 only tasks which gets into details on some task that are often found and not repaired on a first-run of the tool.

Then read this: Repair Tasks - Some Tasks Lost Apparently where “Norwood451” did a better job documenting the actual utility use in a walk-through better than I could.

Fixed in 14 steps. See below.

    1. Issue was Caused by reverting from Windows 10 back to Windows 7 (in my case windows 7 64 Bit)
    2. Download Repair Tasks by Dijji at https://repairtasks.codeplex.com/
    3. Download Windows7 Tasks.zip (DO NOT UNZIP) at https://repairtasks.codeplex.com/releases/view/617575?RateReview=true
    4. Create a Folder called AAAAATASK in your Documents (Which can be found START > Documents)
      C:\Users\David\Documents\AAAAATASK
    5. Open the downloaded RepairTasks.zip file From step 2 and copy both files (RepairTaskes.exe and RepairTasks.exe.config to the AAAAATASK folder in your documents folder.
    6. Copy the entire downloaded zip file Windows7 Tasks.zip to the AAAAATASK folder in your documents folder.
    7. Right click and Run as administrator RepairTaskes.exe
    8. Click the Scan Button to get list of corrupted files
    9. Click the repair Button. (most or all of the tasks should be repaired now. If not, go to step 10.
    10. Click the Radio button> Take tasks from backup
    11. Click Scan for a list of the remaining corrupted files.
    12. Click Repair again.
    13. You will get a pop-up window asking where the RepairTasks.zip is located-- the file you created AAAAATASK, which should be on the very top – of course, as reason for the name of the file.
    14. You can test by running Both Scans and if you do not get anymore lists of files. Boom! You are done.

Yep that is pretty much it.

After I did my first scan for issues I saved the results in a TXT file; that is where I got the list of 46 issues I opened up this post with. Super handy.

I then ran the “Repair” routine which almost instantly fixed 41 of them, leaving 5 remaining as seen below.

2016-02-14 13_07_53-Typical Windows 10 reversion errors

I then attempted a repair of those remaining five tasks from the offered “Windows7 Tasks.zip” file provided and did a second repair. That did the trick!

2016-02-14 13_08_35-Repair Tasks - Some Tasks Lost Apparently - Internet Explorer

When I was all done and subsequent reboots confirmed a normal Task Scheduler again, I ran a scan one last time and then chose a “Backup Tasks” routine to tuck these away in case this happens again. That way I can rely on my own system.

GSD Tip: If you do decide to do a Windows 7 to Windows 10 upgrade, be sure you take your own manual backups, set some system restore points, and also use this took to take a backup of your Tasks for good measure.

I think Dijji could be selling his project features just a bit short and recommend also highlighting it as a “regular” Task Scheduler backup tool, not just as a “repair” tool.

Yes…it was really THAT easy!

Repair Tasks – CodePlex project by Dijji – highly Valca recommended!

Cheers!

Fixing Glasswire Upgrade Issue: failed to attach to service

Man on a mission!

And in this GSD post The Struggles I explained an issue I had upgrading my free version of GlassWire on my Windows 7 Ultimate system.

And no sooner had I completed that task than GlassWire wanted to update to a new version as well.

So I went though the download/install process and it seemed to go on OK, but when it opened up it could not reconnect to the Glasswire service.

When I checked the Windows Service for it again it also showed marked for deletion.

So I uninstalled Glasswire, rebooted reinstalled Glasswire but again it could not attach to the service.

I checked the service again. It was present and set to Automatic but stopped. When I clicked “start” the service launch crashed with an error I didn’t capture.

Rinse-repeat-same result.

The updated Glasswire version 1.1.36b was doing fine on the upgrade process on Lavie’s laptop and my other Win 7 x64 laptop so I’m not sure what was the issue here.

Next I found an even newer version 1.1.4.850b. Same issues.

Finally I found the original Glasswire version 1.1.32b on one of my duplicated (but not recently sync’ed) USB drives.

That installed fine. The Glasswire service started automatically, and the app reconnected with no issues. So I’m leaving it there for the moment on this system.

So last weekend I turned my attention to troubleshooting that issue.

I did a few more rounds of uninstall/reinstall but to no avail and only the version 1.1.32b would work when installed.

I poked around on the GlassWire Official Forum a while and found a few others who had similar installation and/or service attachment issues.

So from those I came up with my own game-plan.

  1. Make sure the Glasswire service GWCtlSrv.exe (and any sub-processes) wasn’t running – kill if needed.
  2. Uninstall Glasswire via “Programs and Features”
  3. Delete the “C:\ProgramData\Glasswire” folder
  4. Scan the Registry for all keys with “Glasswire”
  5. Reboot
  6. Temporarily disable any running AV/AM protections (as reasonable).
    1. MalwareBytes AntiExploit
    2. Microsoft Security Essentials
    3. CryptoPrevent
    4. MalwareBytes Anti-Malware
    5. Zemana AntiLogger
    6. Note: EMET was left running
  7. Install the latest Glasswire release build
  8. (if everything OK) – re-enable all AV/AM protections that were disabled.
  9. Reboot and confirm all is well

And I did exactly that.

For step 4 I could have scanned my registry with any number of free utilities to make the process easier;

In the end I found Registry Finder the easiest to work with for this particular task.

I did a search in it for “Glasswire” and it came back with quite a lot of related keys still left over. I first exported these then I deleted them and rebooted the system. Nothing seemed harmed so I proceeded.

For step 6.3 I ended up “restoring” my original settings by choosing the “None – Remove all protection” option of CryptoPrevent.

My thought on temporarily disabling all of these were that perhaps some protection was blocking the proper installation/registration of the Glasswire service.

I then installed the latest version of Glasswire and it went on with no issues, connected to the Glasswire service, and the graph starting working normally again.

Hurray!

I re-enabled all the protections and rebooted.

Glasswire worked normally again.

Mischief managed.

Or was it?!! For another purpose I had to go into my “Task Scheduler” and was suddenly flooded with a long series of pop-ups like this for LOTS of different tasks. Oh SNAP!

2016-02-13 22_21_32-Task Scheduler

Come back for Episode 2 – in which Task Scheduler’s “The task image is corrupt or has been tampered with.” error is assessed, understood, and vanquished!

--Claus Valca

Open Live Writer–There are Nightlies!

It’s nice to have some time to deep dive blogging and chasing down technical itches.

On Saturday I posted frustrations and hopes regarding Open Live Writer; basically no “categories” list picks and no spelling.

But I also posted that an Open Live Writer pre-release build was available that had support added for categories.

So yesterday I downloaded it and tried it out on my “non-production” laptop. And it worked great. I just installed it on top of the existing “release” version and things were grand.

So this morning I was getting ready to load it on my “production” home system but got looking at the latest build update version.txt file on that AppVeyor page.

It was kinda interesting but what really caught my attention was a reference link to a “nightly/Releases/Releases” path and a freshly baked 0.5.1.5 version setup file.  Hmmm.

Some quick Google work and I located this Open Live Writer project page discussion:

Turns out there are two ways to get “nightly” OLW builds.

The first is via a registry setting that drives OLW to pull from new releases when it loads. As explained by the developer “ScottIsAFool”

HKEY_CURRENT_USER\SOFTWARE\OpenLiveWriter\Updates

Then you need to create a dword key for CheckForBetaUpdates 1 = beta, 0 = regular.

I have a plugin that will let you switch between them coming at some point.

Quickly followed by these “here be dragons” comments by developer “martinwoodward”:

It should update to the latest build from the CI server so does give you a more up-to-date version. "More functional" is harder to say, it might have more features but one you rely on might get accidentally broken. We'd hopefully spot that and get it fixed quickly but OLW is only going to check once per day that you restart the app.

Basically, know that if you are on the CI builds then you might get broke. The good news is that if that happens, uninstalling the app (making sure the reg keys get deleted) and installing the latest version from openlivewriter.com will get you back onto the stable build if something goes really badly wrong.

Having a certain amount of folks running on the latest build would be really helpful in case something got broke that we wouldn't have otherwise noticed, but please only do it if you are comfortable with living on the edge a little more.

However reliably getting you OLW nightlies using the registry tweak method (currently) could be problematic as developer “willduff” explains:

Problem is that we haven't bumped the version number. Right now the nightly version number is the same as the public release version number, so your local copy thinks its already up to date and skips re-downloading the same version. Let me see if its safe to bump the version number now...

But “willduff” then provides a direct-download link to grab the nightlies from – easy-peasy!

If you want to go install the nightly directly, the latest nightly is always at this URL: https://olw.blob.core.windows.net/nightly/Releases/OpenLiveWriterSetup.exe

And a note for those who ALSO do the registry tweak:

One more thing to note, if you do go test those builds out that I linked to in issues #224 and #247, and you leave CheckForBetaUpdates = 1, then you'll actually get auto-upgraded to the nightly because I bumped the version. So, if you want to test those builds properly, you'll want to set CheckForBetaUpdates = 0 temporarily.

GSD Testing Tip: This is a good point -- so what I did was to export that Registry key in both states with different names. This way I can “toggle” the beta update check “on” (CheckForBetaUpdates = 1) or “off” (CheckForBetaUpdates = 0) depending on what I want to do.

So Claus, what’s the result on your system using the latest OLW nightly (build listed as 0.6.0.0 and file timestamps from 02/13/2016)?

The “Set categories” feature is working wonderfully now.  At first my drop list was still blank but I hit the “refresh” button at the top and after a moment they all populated. Looks just like the original WLW feature.

Spelling was folded into this build as well. But…there seems to be a limitation at the moment.

It isn’t working on my Windows 7 system and that feature is grey’ed out.

puvddkkp.5c3

Looking in the OLW About section credit is given to the feature source

PlatformSpellCheck (MIT) Copyright © 2015 Bruce Bowyer-Smyth
https://github.com/bbowyersmyth/spellcheck/

Which shows where the limitation is at:

Managed wrapper for the Microsoft Spell Checking API available in Windows 8 and Windows Server 2012 and later.

So since I am running OLW on a Windows 7 platform, no integrated spell-checking is available (yet) for me.

This discussion exchange between “ScottIsAFool” and “bbowyersmyth” summarizes the situation for Windows 7 users at the moment.

ScottIsAFool commented Dec 22, 2015

Is there anything in place for if the user is running this on Windows 7? I haven't looked through the code yet, so if there is, forgive me :)

bbowyersmyth commented Dec 22, 2015

No there isn't. This is PR is to get the spell check back up and running using the Windows spell check API (Win8 and later). Win7 will need to be addressed separately with an API that has it's own dictionaries.

ScottIsAFool commented Dec 22, 2015

Sorry, I should have been clearer. What happens if this is run on Windows 7 with your changes in place. I know spell check won't be there, I'm just making sure it doesn't crash or anything :)

bbowyersmyth commented Dec 22, 2015

Oh right. The spelling will be disabled/unavailable like it is currently. There are IsPlatformSupported checks in the initialization.

However hope remains for us Windows 7 folks using OLW when a different API method is added.

So, to summarize.

That is progress!

Cheers.

--Claus Valca

Saturday, February 13, 2016

PowerShell one liner to get USB Flash Drive Serial Number

First a confession, I bought the “Learn Windows PowerShell 3 in a Month of Lunches” book quite a while ago but still haven’t had the discipline to work my way through it.

Couple that with tons of PowerShell learning resources documented across the GSD blog and I am woefully behind the game.

However, I can read music so I guess that means I can puzzle out code with patience and Google searching.

One of my duties is to keep inventory of USB device issuances to the team. I record the serial numbers of the devices in a spreadsheet.

While some external USB HDD’s have the device serial number listed on the external case, USB flash drives aren’t so good wtih that practice.

There are some USB imaging tools such as the USB Image Tool or utilities such as USBDeview or Kanguru’s free Serial Number Display Tool that I could use to get that information directly.

However, I really like to stick with “in-box” tools and techniques so while that would be the “easy” way I’ve been collecting the information the “long-way-round” by the following process:

  1. Insert USB flash drive into system.
  2. Open Control Panel
  3. Open Device Manager
  4. Expand the “Universal Serial Bus controllers” item
  5. Look for the “USB Mass Storage Device” in the list (that’s my inserted flash drive)
  6. Right-click that item and select “Properties”
  7. Select the “Details” tab
  8. In the Properties list, pick “Device Instance Path”
  9. Read the serial number which is the trailing string after the last “\”

Eject and repeat.

What I wanted to do was just run a “WMIC” query directly from the command line to get that specific information via the Command Prompt.

But despite my best efforts (which isn’t saying much) I wasn’t able to locate the correct parameter.

Tonight I did find and tweak a similar command via PowerShell and it does the trick. So while it isn’t elegant, it does the job I need. Victory at last!

gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} | Where-Object {($_.Description -like '*mass*')} | Sort Description,DeviceID | ft Description,DeviceID –auto

(That’s one long string btw.)

So I can get a result like this:

Description             DeviceID
-----------             --------
USB Mass Storage Device USB\VID_0DD8&PID_3200\<serial number displayed here>

Your DeviceID details will vary depending on the make/model/etc. but the serial number is there easy to copy/paste.

Credits:

wmi - Getting a USB Device Instance Path in Powershell - Stack Overflow. This post got me finally on the right track but still didn’t work for me.

Displaying USB Devices using WMI - Windows PowerShell Blog.  Jeffrey Snover’s post did get me the output I was looking for, but I then needed to clean it up just a bit as I only wanted the “USB Mass Storage Device” information.

Filtering PowerShell Objects - PowerShell content from Windows IT Pro. This was the final bit in giving examples how I could filter for just the one line I needed.

If anyone can “refine” the code or filter it more to just pass on the Serial Number string itself, I would be grateful for any recommendations.

Using PowerShell’s gwmi or the Command WMIC call are powerful ways to get system information.

Here are some additional examples that I’ve collected trying to puzzle out my own particular USB Mass Storage device query technique that could be helpful to sysadmins:

Cheers!

--Claus Valca.

Bonus USB utility finds:

Universal Extractor and updated “builds”

One of the most important utilities that I use weekly is the Universal Extractor from LegRoom.net.

It has a very large version of supported formats for archive unpacking but hasn’t been updated in a very long time.

I’ve manually updated some of the included binaries from time to time, but the Inno Setup Unpacker file is the one I need updated regularly. I get it from innounp and overwrite the older version in my bin folder. Current version as of the time of this release is 0.45 and supports Inno Setup versions 2.0.7 through 5.5.7 for all your unpacking needs.

I was excited to learn about a project to try to update not just the various unpacker binaries but the application itself.

Universal Extractor 2 – Bioruebe.com (changelog here)

From the project page:

As a short overview here is a list of the core improvements:

  • Batch mode
  • Silent mode, not showing any prompts
  • Scan only mode to determine file types without extracting
  • Integrated updater
  • 100+ new supported file types
  • Audio and video extraction for multimedia files
  • Cascading context menu
  • Support for password list for common archives
  • Improved optional status box with progress indicator
  • New detection methods + more detailed output and error messages
  • Support for some extractors not shipping with UniExtract as plugins
  • Resource usage/speed improvements, lots of fixes
  • First start assistant instead of installer
  • Full functionality available in no-install version
  • Auto-using 64 bit versions of extractors if supported by OS

Martin Brinkmann at ghacks.net has a good review of the differences; First look at Universal Extractor 2

I’ve not tossed out the original UE app that I’ve been using all these years but I’m keeping this one close by for comparisons.

Cheers.

--Claus Valca

Only my own procrastination to blame…

Three years ago – almost to the day – I posted this: grand stream dreams: …you’re getting warmer!

Then at the end of last year I posted this: grand stream dreams: Biting the hand…

Both were (mostly) fussing about the rising price of renting our cable modem box and my desire to finally buy my own unit.

Still haven’t done it yet. But I AM going to!

So here are some updated links to spur me onward.

Cheers.

--Claus Valca