Is diarrhoea advantageous to the microbe?
Vibrio cholera for example is actively causing diarrhoea, by stimulating the CFTR channel to excrete chlorine ions, which will attract water from the gut tissue. 

The answer of the function seems obvious: to promote dispersal in the environment and as such infect/find new hosts.
See also: extended phenotype (Richard Dawkins): how genes in one organism (mostly a parasite) influence the behaviour of another organism (mostly the host of the parasite) to increase the (reproductive) success of the gene/parasite.
Also: numerous (some horrifying) examples in Parasite Rex (by Carl Zimmer)