Here, I even verified my own code for a change ;\)
Change "NewPCName" to the new computername u want \:\)

Make sure you reboot to make the change go in effect after runinng this script. This will assume you have Network admin privilidges or at least Account Operator privilidges. It will error out if there are none.

 Code:
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$x = $objWMIService.InstancesOf("Win32_ComputerSystem").Item("Win32_ComputerSystem='"+@WKSTA+"'").Rename("NewPCName")
If $x <> 0
  ? @SERROR
  Exit @ERROR
EndIf