You have a few options to collect the Mac OSX software serial number from the command line. One option is the serverserialnumberutil command:
sudo /System/Library/ServerSetup/serverserialnumberutil -get
Another option is to su to root (sudo su -) and do the following:
It’s good to store these serial numbers in a secure place in case you need it in the event of a failure.