Quantcast
Channel: Exchange Server 2013 - Mail Flow and Secure Messaging forum
Viewing all articles
Browse latest Browse all 3660

Clearing Specific Queue on Schedule

$
0
0

I need to setup a Powershell script to periodically delete all emails in a specific Queue ID. I have tried the following and receive errors (following PS line post):

Get-TransportServer | Get-Queue | Get-Message -ResultSize unlimited | where {Queue -eq "<server>\<queueID>"}
 | Remove-Message -WithNDR $False

Errors:

Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
    + CategoryInfo          : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [],
   PSInvalidOperationException
    + FullyQualifiedErrorId : RemotePipelineExecutionFailed

A positional parameter cannot be found that accepts argument '<server>\<queueID>'.
    + CategoryInfo          : InvalidArgument: (:) [Get-Queue], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Get-Queue

What am I doing wrong? Manual deletion of the stuck emails is not acceptable, it needs to run on a schedule. Please advise. TIA


Viewing all articles
Browse latest Browse all 3660

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>