Internal Windows powershell error. Failed 80070002

Solution 1:

Uninstalling and reinstalling Windows Management Framework 4.0 (KB2819745) resolved the error.

Solution 2:

I used this script to test all the .NET folders

@echo off
cd C:\Windows\Microsoft.NET\assembly\GAC_MSIL
for /D %%z in (*) do (
  echo %%z
  rename %%z %%z1
  powershell 'powershell works'
  rename %%z1 %%z
  pause
  echo.
)

Out of 236 folders, the only one that gave me error 80070002 was

Microsoft.PowerShell.ConsoleHost

You can repair PowerShell likes this

wusa /extract:. Windows6.1-KB2819745-x64-MultiPkg.msu
dism /online /remove-package /packagepath:Windows6.1-KB2819745-x64.cab
dism /online /add-package    /packagepath:Windows6.1-KB2819745-x64.cab