Hmm, I wasn't aware of the -g flag for the open command. Thanks for pointing that out @JRM][/url][/url :)
FWIW, I recently discovered that Applescript has a similar function. Instead of using 'activate' use 'run' to make an application launch in the background.
tell application "Messages" to run
or
osascript -e 'tell application "Messages" to run'
Incidentally this actually works somewhat better, as it doesn't cause the applications windows to appear, even in Mission Control. The app icon shows in the Command-Tab switcher and in the Dock, but the app window shows up nowhere until its clicked on or switched to.
Another note - you can avoid worrying about the grep picking itself up in the results if you use ps axc. That outputs a neat list of just the application names, based on the Finder display name and not the full path. It also for whatever reason avoids needing to use grep -v grep or other tricks to avoid grep picking up its own results.
So combining these 2 together, you could also try this-
if [ `ps axc | grep -c Messages` == 0 ]; then osascript -e 'tell application "Messages" to run'; fi
Though it didn't occur to me that users may simply be able to set themselves to unavailable or offline if they choose not to be bothered by IMs. Ultimately this seems more like a company policy issue that might need attention from someone in HR or whatnot, rather than a technical problem.