How to Fix Windows Error Code 126 (Sept. 2018 Update)

How to Fix Windows Error 126

The 126 error Code is usually related to some issues with the configuration of the system files in Windows operating systems. It may be caused by the damage of some system files and entries, which, in turn, may lead to instability of the entire OS. An incomplete installation of software, incomplete uninstallation of different applications, improper deletion of data or force shutdown of the computer, may all result in the occurrence of the 126 error Code. In some cases, the error may appear if your computer is recovered from a virus attack where the deletion or the corruption of entries in the windows registry may lead to missing and wrongly linked files, which are needed for the proper operation of the PC. If you are recently facing the error 126 Code on your computer, then, on this page, you will find a helpful list of instructions, which could help you to troubleshoot the problem on Windows Windows 8.1/ 8, 7 and Vista operating systems.

Fixes to error 126 Code for Windows 8/8.1, 7 & Vista

Fix 1: Reinstall iTunes and other problematic applications on your computer

If error 126 Code appears when you are trying to use iTunes, other Apple products or different applications that you have installed on your PC, it means that there is something wrong with the system, the program files may be missing or corrupted and, in that case, you may need to reinstall the software products to get rid of the problem.

Reinstall programs in Windows 8.1/ 8:

  1. Press Windows Key + X and then click on “Programs and Features”.
  2. Right click a program that you would like to uninstall and choose the “Uninstall” option. 

It is advisable to first try to uninstall the following programs and see if the problem is fixed: Apple Application Support, Apple Mobile Device Support, Apple Software Update, Bonjour, iCloud, iTunes, MobileMe

  1. Next, restart your machine.
  2. Select My Computer desktop shortcut and manually remove the following folders:

C:\Program Files\Bonjour

C:\Program Files\Common Files\Apple

C:\Program Files\iPod

C:\Program Files\iTunes

  1. Download new setup of iTunes from the official website and install it on your computer.

Reinstall programs in earlier versions of Windows:

  1. Click the Start menu and select the Control Panel 
  2. select Programs>Uninstall a Program
  3. Repeat the steps from 2 to 5 from the Reinstall programs in Windows 8.1/ 8 paragraph.

Fix 2: Modify the system variables as shown below:

For Windows 8.1/ 8 and Earlier Versions:

  1. Right click on My Computer desktop shortcut.
  2. Select Properties and click on the “Advanced system settings” link (displayed on left side panel).
  3. A System Properties dialog box will appear with Advanced tab opened as default.
  4. Click the “Environment Variables” button and select “System Variables”.
  5. There, you’ll find “Path” in the “Variable” variable. Select it and click the Edit button.
  6. You may find some value specified in “Variable Value” textbox. Do not replace it. Just type a semi colon (;) at the end of the existing value and the new path specified:      6.a) In case “Variable Value” textbox is empty, type below command: 

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\wbem                                                                                                                                                                                      6.b) In case “Variable Value” textbox is filled with some paths, type below command: 

;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\wbem

  1. Click OK and reboot the computer.

Fix 3: Set Windows Defender to run Automatically

In case that the startup type of Windows Defender has been changed, you’ll have to reset it to “Automatic” in order to fix error 126 Code. 

This is how to do that for Windows 8.1/ 8 and Earlier Versions:

  1. Press Windows Key + R
  2. Type “Services.msc” and click “OK”
  3. Scroll down, locate and right click “Windows Defender” and select “Properties”
  4. Under “General” tab and “Startup Type” drop down box select “Automatic” option
  5. Click on “Apply”, and then “OK:

Fix 4: Delete Repository Folder

Error 126 may occur when the files in the Repository folder are corrupted. To use this fix, first, stop Windows Management Instrumentation service and then delete this folder. It is very important to stop the service before proceeding since it uses the Repository Folder.

For Windows 8.1/ 8 and Earlier Versions:

  1. 1.Press Windows Key+ R
  2. Type “Services.msc” and click “OK”
  3. Right click “Windows Management Instrumentation” service and select “Stop”
  4. Close the tool and then select the My Computer desktop icon
  5. Browse the following folder: C:\Windows\System32\Wbem
  6. Delete “Repository” folder and restart your PC

Fix 5: Copy Missing File from the Installation Disc

Error 126 Code may appear when “srvsvc.dll” file is missing. This file is located in the i386 folder in Windows installation disc. The same file is copied to your hard disk during Windows installation. To fix the problem, copy the file again to your hard disk with Command Prompt and place it in the correct directory.

Here is how to do it for Windows 8.1/ 8:

  1. Insert Windows 8.1/ 8 installation disc
  2. Press the Windows Key + X and click “Command Prompt (Admin)”
  3. Type the following command:

expand X:\i386\srvsvc.dl_ C:\Windows\system32\srvsvc.dll

(In above command, replace “X” with the appropriate DVD Drive letter)

  1. Press ENTER

For Earlier Versions of Windows:

  1. Click the Start menu, hover your mouse at All Programs | Accessories 
  2. Right click Command Prompt, choose Run as Administrator
  3. Type the following command:

expand X:\i386\srvsvc.dl_ C:\Windows\system32\srvsvc.dll

(In above command, replace “X” with the appropriate DVD Drive letter)

  1. Press ENTER

Fix 6: Repair the WinSock with the command given below.

For Windows 8.1/ 8 and Earlier Versions:

  1. Open Command Prompt as mentioned in “Copy missing file from installation disc” paragraph
  2. Type the following commands:

netsh winsock reset

netsh advfirewall reset

       3. When you’re done with the execution of these commands, reboot your computer.

Fix 7: Reregister DLL File

The 126 error Code may also signify that the DLL file registration entries can be corrupt. Unregister and reregister the DLL file as shown below to fix the issue:

For Windows 8.1/ 8 and Earlier Versions:

  1. Open Command Prompt as mentioned in “Copy missing file from installation disc” paragraph
  2. Type the following command- RegSvr32.exe MSSTDFMT.DLL
  3. Press ENTER.

Leave a Comment