If you want to script enabling or disabling the root account in Mac OS X (instead of having to go to Directory Utility to do it), you’ll want to use the dsenableroot command.
Enable the root user
Disable the root user
Just keep in mind that you have to use the syntax as given. You cannot bypass giving an actual username and password of an admin account by being logged into that admin account and prefixing the command with sudo.
Any commands you put into the terminal on a computer, by default, will go into that user’s .bash_history file stored as plain text. So if it’s one-off on a local computer, be sure to edit that file later and delete that line. If you’re using some other remote way to deploy the command, make sure it’s being sent over a secure (and protected) connection of some sort.