Fix SCCM Client Installation Error 0x80041002

Today, I had problem installing CM client on a machine. Both manual install and client push methods did not work. I checked the ccm.log file on the SCCM server and found this error.

1

The error code indicates that the WMI repository on the client is broken. In order to fix this error, we have to rebuild the WMI repository.

I run the Windows commmand (cmd.exe) as a local administrator and try these commands.

  • winmgmt /verifyrepository
  • winmgmt /salvagerepositor

The first command checks for the consistency of the WMI repository and the second command rebuilds the repository if an inconsistency is detected.

However, these commands do not fix the problem for me. So I end up with rebuilding the WMI repository manally by follow these steps.

  • Change the startup type of the Windows Management Instrumentation to Disabled and stop this service
  • Go to %windir%\System32\wbem and rename the Repository folder to Repository.bak
  • Run the cmd.exe as administrator and CD to %windir%\System32\wbem
  • Run for /f %s in (‘dir /b /s *.dll’) do regsvr32 /s %s
  • Change the startup type of the Windows Management Instrumentation back to Automatic
  • In the cmd.exe windows, run cd /d C:\ to go back to the root of the C drive
  • Run for /f %s in (‘dir /s /b *.mof *.mfl’) do mofcomp %s
  • Reboot the machine

After reboot the machine, I push the CM client to the machine again and it works. Yay!

 

 

 

Advertisements

AWU Lookup

Written in C#, this application scans the Uninstall registry keys under HKLM to find all information about installed applications on a machine. It’s very helpful when we want to look for the UninstallString, which can be used as the uninstall command of a SCCM application.

I wrote this application because it takes too long for me to look for the UninstallString of an application every time I create an SCCM application.

Note: This application requires .NET Framework 3.5

1

2

The Windows Update tab searches for all Windows updates on the machine. In order to use it, you have to set the ExecutionPolicy to RemoteSigned, Bypass or Unrestricted (not recommended) on your machine.

1

Download: https://1drv.ms/u/s!ApTGRONy40Xed5wZjHM2VwXwPK0

 

Have fun!

Install Application using PowerShell in SCCM

Today I did some testing with installing an application in SCCM using PowerShell. I found out a few interested things and I want to share it with you guys.

In order for an application to be successfully installed, there are few things that we have to setup.

1. Change the PowerShell execution policy

From Client Settings, change the PowerShell execution policy to Bypass in the Computer Agent category.

clientsetting_powershell

If we don’t do this, we’ll get an error message when trying to install the application from the application catalog.

error1

The error is also captured in the AppDiscovery.log file on the client.

error2

Note: You may not have to do step 1, if you don’t use PowerShell script for application detection.

2. Include the Bypass ExecutionPolicy in the install command

If you don’t set the PowerShell ExecutionPolicy to Bypass or Unrestricted on your machine, you have to include it in the install command similar as below.

powershell.exe -ExecutionPolicy Bypass -file “.\Install.ps1”

If not, you will get an unmatched return code 1 error, captured in the AppEnforce.log file.

Have fun!