The Install-MsmqMessageQueue removes and re-creates queues. This can take several tries, to the function loops until it can successfully create a queue. Currently, there is no limit to the number of times it will try to create the queue. This can cause scripts to hang. Update the function to wait a maximum of 10 seconds.
The same problem exists in Remove-MsmqMessageQueue. Fix it there, too.