6

I try to purge the queues in SDL Tridion with help of powershell. I want to run this scripted without GUI invention. But I can't figure out how I can get rid of the Confirm question.

PS C:\Users\frsu10e1> Remove-TcmQueueMessages -Confirm

Confirm
Are you sure you want to perform this action?
Performing operation "Remove-TcmQueueMessages" on Target "PublishQueue, DeployQueue, SearchQueue, WorkflowAgentQueue, BatchQueue".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): 

I can't figure out what to pass to the -Confirm parameter. It doesn't matter if I specify all queues (default) or just one or two. Any ideas?

1 Answer 1

8

Short answer:

Remove-TcmQueueMessages -Confirm:$false

Explanation:

The -Confirm switch is a standard parameter in PowerShell and actually indicates that you want it to ask you for confirmation before doing anything destructive / permanent. The companion switch is -WhatIf, which you can use to find out what the cmdlet would do, without it actually doing it.

Any cmdlet that supports -Confirm and -WhatIf will also declare the impact of the action. There is a built-in $ConfirmPreference variable that you can use to decide what the minimum impact is that you want it to prompt for. But if the impact is High, you will need to explicitly suppress the confirmation by passing in $false.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.