"Ошибка загрузки провайдера" во время процесса установки

Я выполняю два сценария Powershell в процессе установки из настольного приложения под 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"

Но выполнение скриптов Powershell не является успешным. Я получаю следующие ошибки:

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

Процесс установки начинается с прав администратора. Первый сценарий добавляет комбинации клавиш в фильтр клавиатуры (функция IoT в Windows 10).

Вторые сценарии включают и настраивают Shell Launcher (также функция Windows 10 IoT).

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
     }
 }

Если я выполняю сценарии Powershell в пакетном файле или на консоли Powershell, все работает нормально. Я также пытался выполнить сценарии Powershell во время процесса установки с Powershell x86 и x64, в обоих случаях были одинаковые ошибки.

Какие-либо подсказки, советы или решение для этой проблемы?

0 ответов

Другие вопросы по тегам