InvalidOperation: (sh.exe:String) [Set-ProcessMitigation], I



我在安装npm install ng-factory时遇到问题。我在社区NPM问过,他们说这是ASLR的 git 问题。所以我找到了这个命令来将我的 git .exe 文件添加到 windows ASLR禁用的文件:

Get-Item -Path "C:Program FilesGitusrbin*.exe" | %{ Set-ProcessMitigation -Name $_.Name -Disa >> ble ForceRelocateImages }

但结果是:

Set-ProcessMitigation : Multiple matches found.
At line:1 char:58
+ ... *.exe" | %{ Set-ProcessMitigation -Name $_.Name -Disa >> ble ForceRel ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (sh.exe:String) [Set-ProcessMitigation], InvalidOperationException
    + FullyQualifiedErrorId : Multiple mitigation policies found that may match the given process name. Please specify
    the full path to be matched instead.,Microsoft.Samples.PowerShell.Commands.SetProcessMitigationsCommand

我该如何解决这个问题?

编辑:我尝试了这个命令:

Get-Item -Path "C:Program FilesGitusrbin*.exe" | %{ Set-ProcessMitigation -Name $_.Name -Disable ForceRelocateImages }

但仍然给我这个错误消息:

Set-ProcessMitigation : Multiple matches found.
At line:1 char:58
+ ... *.exe" | %{ Set-ProcessMitigation -Name $_.Name -Disable ForceRelocat ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (sh.exe:String) [Set-ProcessMitigation], InvalidOperationException
    + FullyQualifiedErrorId : Multiple mitigation policies found that may match the given process name. Please specify
    the full path to be matched instead.,Microsoft.Samples.PowerShell.Commands.SetProcessMitigationsCommand

不确定你从哪里得到脚本,但

#                THIS SHOULDN'T BE HERE  ||||
Set-ProcessMitigation -Name $_.Name -Disa >> ble ForceRelocateImages

它应该是:

Set-ProcessMitigation -Name $_.FullName -Disable ForceRelocateImages

编辑:根据评论将Name更改为FullName

最新更新