【问题标题】:NSIS call powershell cmdlet Update-MpSignature not recognized as the name of a cmdlet powershellNSIS 调用 powershell cmdlet Update-MpSignature 未被识别为 cmdlet powershell 的名称
【发布时间】:2021-05-07 10:21:01
【问题描述】:

我使用NSIS调用powershell更新windowsdefender定义,但是当我使用nsExec::ExecToStack '"powershell.exe" -c Update-MpSignature'时,报错“Update -MpSignature 未被识别为 cmdlet powershell 的名称”。我试过在cmd中调用“powershell.exe”-c Update-MpSignature,效果很好。我也试过 NSIS 官方的 psexec.nsh ${PowerShellExecFileLog} call Update-MpSignature in ps1 file ,其他的cmdlet比如Get-ChildItem、Remove-Item都可以很好用,但是还是报错“Update-MpSignature 未被识别为 cmdlet powershell 的名称。有人可以帮助我吗?

【问题讨论】:

  • 没有官方的powershell头文件,你一定是在说wiki。

标签: powershell nsis


【解决方案1】:

这听起来像是 64 位问题。

在 64 位系统上,您可以尝试像 this header file 那样执行 $WINDIR\sysnative\windowspowershell\v1.0\powershell.exe

【讨论】:

  • 我试过用用户this header file替换官方的psexec.sh,但还是报错“Update-MpSignature is not Recognized as the name of a cmdlet powershell”。
  • 感谢您的帮助!这确实是一个 64 位问题。我发现使用 windows powershell 可以执行这个 cmdlet。但是使用windows powershell(x86)报错“Update-MpSignature is not Recognized as the name of a cmdle”。我使用 ${DisableX64FSRedirection} nsExec::ExecToStack '"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" Update-MpSignature'。效果很好。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-12
  • 2016-01-28
  • 2018-11-22
  • 2019-12-18
  • 1970-01-01
  • 2018-10-30
相关资源
最近更新 更多