Fixing the Software Metering agent when having error 80070424 in the mtrmgr.log

I was configuring Software Metering at a costumer when reports seemed wrong. The costumer had already configured metering on Visio,exe which had been running for years, but only 60  installations was reporting usage in the past 120 days out of 540 total installations. I checked maintenance task on the site server and client settings to ensure that the server and clients was configured correct.
I looked into some of the log files on the clients and found this error:

StartPrepDriver – OpenService Failed with error 80070424

After some googling i found this Microsoft article and created a package to fix the issue, but now i was confronted by a new error i the log :

StartPrepDriver – OpenService Failed with error 2

I found another forum(can’t find the link), where it was stated that the installation had to be run as a local admin on the machine. After some testing i could confirm the statement.

The environment did’t not have configured the users to be local admin so i had to use a service account, and the only secure way of running in anther user context (that i know of) is running a task sequence.

Collecting the broken clients

First we need a collection including all the clients with the error. I choose to use a Configuration Baseline, you can import it into your own configuration using the .cab file or set it up yourself using this script as a Configuration Item:

Configuration Baseline to import:

Download: CB – Check Software Metering Agent

Script used in Configuration Item:

After the baseline has been imported we deploy it to a collection. In this example I deploy it to ‘All Desktop and Server Clients’, you can choose the schedule as preferred.

After that we create a collection based on the non-compliant clients from that deployment.

Now we have a collection which includes all the broken clients.

Deploying the fix

Now we want to prepare the package containing the script to fix the error. Copy the script to your package source share. Change the $LogLocation variable to what you prefer, currently its “$env:windir\Logs\Software”

Download: Set-PrepDriver

Create a simple package with no program, pointin at the location to the Set-PrepDriver location.

Create a custom Task Sequence with the ‘Run Command Line’ step running as the local admin service account.

powershell.exe -ExecutionPolicy Bypass -file .\Set-PrepDriver.ps1

Deploy that task sequence to the collection created earlier.

Specify the deployment setting as Required.

Specify the deployment setting to only rerun if failed previously.

Specify the deployment setting to not show progress.

Run a machine policy update on the client and check the logs.

The next time the Compliance Basline shedule is running the client object will be remove from the collection.

3 thoughts on “Fixing the Software Metering agent when having error 80070424 in the mtrmgr.log”

  1. Good job, but you can also fix it with a Remediation script directly in the Configuration Items. Here what I have used.

    $CurrDate = ‘{0:yyyy-MM-dd}’ -f (get-date)
    Start-Process -FilePath “C:\Windows\System32\RUNDLL32.EXE” -ArgumentList “SETUPAPI.DLL,InstallHinfSection DefaultInstall 128 C:\WINDOWS\CCM\prepdrv.inf”
    stop-service ccmexec -Force
    Start-Sleep -seconds 20
    Rename-Item -Path “C:\Windows\CCM\Logs\mtrmgr.log” -NewName “mtrmgr-$CurrDate.log”
    New-Item -Path “C:\Windows\CCM\Logs” -Name “mtrmgr.log” -ItemType “File”
    start-service ccmexec

    • Hey Jim,

      I think the Configuration Items is running in the local system context, which will result in not fixing the issue.
      During my testing it was not working when running the script as system in 32bit (Package/Program). It resultet in a different error in the log.
      Do you have a different outcome?


  2. That’s weird thought, Because I have it in deployment to 590 computers. A lot of them have been fixed.
    Nevermind! Good luck!


Leave a comment