'Provider load failure' during installation process

别来无恙 提交于 2019-12-24 19:18:56

问题


I execute two Powershell scripts during a installation process from a desktop application under Windows 10 IoT Enterprise.

%WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -File ".\KeyboardFilter.ps1"
%WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -File ".\ShellLauncher.ps1"

But the execution of the Powershell scripts is not successful. I get the following errors:

Get-WMIObject : Provider load failure
At C:\Program Files\Application\KeyboardFilter.ps1:31 char:19
+ ... $predefined = Get-WMIObject -class WEKF_PredefinedKey @CommonParams |
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand


Write-Error : A positional parameter cannot be found that accepts argument 'is'.
At C:\Program Files\Application\KeyboardFilter.ps1:41 char:9
+         Write-Error $Id is not a valid predefined key
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Write-Error], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.WriteErrorCommand


enable-windowsoptionalfeature : An attempt was made to load a program with an incorrect format.
At C:\Program Files\Application\ShellLauncher.ps1:4 char:1
+ enable-windowsoptionalfeature -online -featureName Client-EmbeddedShe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Enable-WindowsOptionalFeature], COMException
    + FullyQualifiedErrorId : Microsoft.Dism.Commands.EnableWindowsOptionalFeatureCommand

The installation process starts with administration permissions. The first script adds key combinations to the Keyboard Filter (Windows 10 IoT feature).

The second scripts enable and configure the Shell Launcher (also Windows 10 IoT feature).

KeyboardFilter.ps1:

 param (
     [String] $ComputerName
 )

 $CommonParams = @{"namespace"="root\standardcimv2\embedded"}
 $CommonParams += $PSBoundParameters

 function Enable-Predefined-Key($Id) {   
     $predefined = Get-WMIObject -class WEKF_PredefinedKey @CommonParams |
         where {
             $_.Id -eq "$Id"
         };

     if ($predefined) {
         $predefined.Enabled = 1;
         $predefined.Put() | Out-Null;
         Write-Host Enabled $Id
     } else {
         Write-Error $Id is not a valid predefined key
     }
 }

If I execute the Powershell scripts in a batchfile or on Powershell console, everything works fine. I also tried to execute the Powershell scripts during the installation process with Powershell x86 and x64, same errors in both cases.

Any hints, tips or solution for this problem?

来源:https://stackoverflow.com/questions/49322437/provider-load-failure-during-installation-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!