Skip to content

Instantly share code, notes, and snippets.

@taddison
Created February 1, 2018 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taddison/067f9c833ca32e366b59a4394449cb5d to your computer and use it in GitHub Desktop.
Save taddison/067f9c833ca32e366b59a4394449cb5d to your computer and use it in GitHub Desktop.
# has a -whatif
$cred = get-credential
$servers = @("server1", "server2")
foreach($server in $servers)
{
Invoke-Command -ComputerName $server -Credential $cred -ScriptBlock { get-msmqqueue | where-object { $_.QueueName -like "*somequeuewildcard*" } | Clear-MsmqQueue -WhatIf }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment