As system administrators, you may have used the feature that sends a message to all users. It’s very helpful when you want to change something that might affect others, or ask for particular attention from new users who log in later.
It’s simply 3 steps as described vSphere Client Help:
Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.
- From the Home page of the vSphere Client, click Sessions.
- Type the message in the Message of the day box.
- Click Change.
The message is sent to all the currently login users, and until the message is changed, any new users see the message upon logining to the vCenter.
Now, how to do with the API?
It’s actually fairly simple. As hinted by the steps from above, it’s related to the session management. Just pick up SessionManager managed object, you will find a method like this:
public void updateServiceMessage(String message) throws RuntimeFault, RemoteException
Note that the above signature is from vSphere Java API. The method in the API doc has _this typed as ManagedObjectReference as its first parameter, which is no longer needed in the Java API.
Even you can change the message, you want to find out what the current message is as well. There is a property called message in the SessionManager. You can use the PropertyCollector, or the simple getter method in Java API as follows:
public String getMessage()
With the API, you can design interesting applications, for example an application that watch an dedicated email account to receive message and post it via the vSphere API.