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

时间:2019-06-14 07:12:19

标签: git powershell aslr

我在安装npm install ng-factory时遇到了问题。我在NPM社区中问,他们说这是ASLR的git问题。因此,我发现此命令将git .exe文件添加到Windows ASLR禁用的文件中:

Get-Item -Path "C:\Program Files\Git\usr\bin\*.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 Files\Git\usr\bin\*.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

1 个答案:

答案 0 :(得分:1)

不确定从哪里获得脚本

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

应该是:

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

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