As far as i know there are two places in the registry to rename a workstation. I change them through the following scriptlines:

$rc = WriteValue ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName","$Asset","REG_SZ")
$rc = WriteValue ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","NV Hostname","$Asset","REG_SZ")

$Asset is a variable which I read from the DMI code of the machine.

Hereafter I reboot and call a second script which makes the machine a part of the domain, I'm using NETDOM.EXE to do this. The main lines are these:

Netdom.exe join
%COMPUTERNAME% /domain:<domainname> /userd:administrator /passwordd:<password>


_________________________
-------------------------------------------------------------- With kind regards, GyroTwister