Have you tried WMIC?
WMIC computersystem where caption=‘current_pc_name’ rename new_pc_name
You could inbed this in an actionscript and leverage relevance substitution.
It would be something like
waithidden WMIC.exe computersystem where caption ='{computer name} rename new_pc_name