清除MSMQ队列并从bat文件重置IIS

Mar*_*tin 8 msmq batch-file

是否可以从bat文件中清除msmq队列?

基本上我想制作一个bat文件或者至少是快速简单的东西,以便未经培训的员工可以在不知道任何shell或管理工具的情况下点击并修复

有人可以帮我正确的方向吗?

GSe*_*rjo 13

看看MSMQAdm Utility

通过实用程序管理的任务包括以下内容:

  • 浏览本地队列
  • 清除消息
  • 删除单个邮件
  • 停止并启动MSMQ服务
  • 连接和断开网络连接

不要忘记PowerShell,看看PowerShell社区扩展

更新

打开powershell并逐行写入

[Reflection.Assembly]::LoadWithPartialName("System.Messaging")
$queueName = '.\Private$\testQueue'
$queue = new-object -TypeName System.Messaging.MessageQueue -ArgumentList $queueName
$queue.Purge()
Run Code Online (Sandbox Code Playgroud)

从cmd调用powershell

  1. 创建txt文件.
  2. 插入所有行
  3. 更改"ps1"上的文件扩展名

从cmd调用脚本的最简单方法.

powershell.exe -executionpolicy Unrestricted C:\ purgemsmq.ps1

  • 我们开始做吧.1)创建txt文件.2)插入所有行3)在"ps1"上更改文件扩展名.4)从cmd调用脚本最简单的方法.powershell.exe -executionpolicy Unrestricted C:\ purgemsmq.ps1 (2认同)