Using T-SQL it is not so easy.
However, since you are planning to use SQL Agent, why not just use the step type of "SQL Server Analysis Services Command". You can get the XMLA script required from Management Studio - right click on a cube, select process and the pop-up box has a button that you can use to save the script that would be used. This can be used in the SQL Agent job.