copied postToAllInstances and added parameters so we can use it without calling it throught the command line.