InvalidOperation:(sh.exe:字符串)[Set-ProcessMitigation],InvalidOperationException

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

我在安装 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

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

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

应该是:

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

编辑:根据评论

Name更改为FullName