我有 Python 代码,它应该使用 Powershell 连接到交换服务器并从队列中删除消息。(我是 Powershell 新手)
Remove-Message -Server SERVERNAME -Filter {FromAddress -like '*MATCH*'} -WithNDR $false
代码在哪里SERVERNAME
以及MATCH
将给出...我的问题是我应该如何在 Powershell 中运行它?所以我这样做了:
powershell -NoExit -Command "COMMAND"
COMMAND
上面的命令在哪里。我想用子进程运行它。当我手动测试命令时,出现此错误:
The term 'Remove-Message' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:15
+ Remove-Message <<<< -Server SERVERNAME -Filter {FromAddress -like '*MATCH*'} -WithNDR $false
+ CategoryInfo : ObjectNotFound: (Remove-Message:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
所以我认为我做错了什么,尽管我认为我将参数正确地传递给了 Powershell。