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?

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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