This is not the same.
Computername refers to the computername under basic Networking meanwhile Hostname is under the DNS section. Though you asked to restart the computer after you change this field (by click and fill) this field is immediately in effect without restarting the computer. So changing it from the script will work immediately. I also can't imagine, why it is good though I have some tips...