首页 > 解决方案 > NSIS 调用 powershell cmdlet Update-MpSignature 未被识别为 cmdlet powershell 的名称

问题描述

我使用 NSIS 调用 powershell 更新 windows 防御者定义,但是当我使用 nsExec::ExecToStack '"powershell.exe" -c Update-MpSignature'时,它报告错误“ Update-MpSignature is not known as the name of a 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 is not Recognized as the cmdlet powershell 的名称。有人可以帮我吗?

标签: powershellnsis

解决方案


这听起来像是一个 64 位的问题。

在 64 位系统上,您可以尝试$WINDIR\sysnative\windowspowershell\v1.0\powershell.exe此头文件一样执行。


推荐阅读