Script to Change Home Directory of vhosts

I am attempting to create a shell script which will change the main domains of most of the vhosts on my server to a more friendly format. Part of doing this will require changing the listed Home directory, HTML directory, and CGI directory for each changed vhost.

I am aware of how to make these changes using the Virtualmin GUI, but I want to be able to automate the process in my shell script. My question is: Is doing this from a shell script possible and, if so, how do I do it?

Any help would be appreciated.