Computer name change in a domain

(imported topic written by SystemAdmin)

I have a script that will change the name of a computer in a domain and I would like to make it a fixlet. How do I do so?

The cmd file is

@echo off

cls

color 70

Echo "|---------------------------------------------------|

echo " This Computer is “%computername%”

echo "|---------------------------------------------------|

echo "| |

echo "|This Utility will Rename a computer on the Domain |

echo "| it must be powered on and connected |

echo "| to the network at the time |

echo "| SYSTEM ADMIN |

echo "|---------------------------------------------------|

REM cd /d …

:redo

rem ********************the following will ask for the compuer name **************************

echo “*** TO QUIT TYPE Q”

echo “oldcomputer %oldcomputer%”

SET /P oldcomputer=Please enter the Current Computer Name :

Rem *****************************************************************

if exist “\%oldcomputer%\c$” goto goodname

echo " %oldcomputer% "

pause

:NotFound

color c0

echo " you typed %oldcomputer%"

echo "

echo "

echo "THE COMPUTER WAS NOT FOUND!!! Make Sure it is powered on "

echo “and on the network at this time”

pause

goto redo

:goodname

color 70

echo "

echo "

echo " The computer %oldcomputer% was found

Echo "

echo " Now we need the new computer name

Echo "

SET /P newcomputer=What is the new name of the new computer :

echo "

echo " Your Username : %username%"

echo " The Current Computername: %oldcomputer%

echo " The New Computer Name: %newcomputer%

echo "

echo " You will now be prompted to enter your PASSWORD Twice:

echo "

echo "

netdom renamecomputer %oldcomputer% /newname:%newcomputer% /userD:NV%username% /passwordd:* /usero:NV%username% /passwordo:* /reboot:600

rem netdom renamecomputer %oldcomputer% /newname:%newcomputer% /userD:nv* /passwordd:* /usero:nv* /passwordo:* /reboot:600 /securepasswordprompt

:stopp

goto redo

SET /P anotherrun=Would you like to rename another?(Y/N) :

PAUSE

end

Thank you in advance for the help.

(imported comment written by SystemAdmin)

Heres the action below… I have not tested this but it should work

I have also included the Fixlet that you can import

action parameter query "Username" with description "Please enter the Username to Authenticate in the Domain"
action parameter query "Password" with description "Please enter the Password to Authenticate in the Domain"
action parameter query "NewName" with description "Please enter the New Computer Name"
waithidden netdom renamecomputer {Computer Name} /newname:{parameter "NewName" of action} /userD:NV\{parameter "Username" of action} /passwordd:{parameter "Password" of action} /usero:NV\{parameter "Username" of action} /passwordo:{parameter "Password" of action} /reboot:600

(imported comment written by SystemAdmin)

Isn’t there a way to change the computername without using the Netdom utility ?

Is there anything built into TEM (bigFix) ???

The provided fixlet doesn’t work in bigfix as the target system needs the “Remote Server Administration Tools (RSAT)” tools installed on the system being targeted to use the “Netdom” utility.

Also, just copying the netdom.exe to the target doesn’t seem to be working either.

The script provided by “markbh91” works outside of bigfix to change computer names in a domain when run from a system that has the RSA tools installed.

Here is my VB version of that script

'On Error Resume Next

'open the file system object

Set oFSO = CreateObject(“Scripting.FileSystemObject”)

set WSHShell = wscript.createObject(“wscript.shell”)

Dim sNewCname 'Variable to hold Computer Name you enter in the inputbox

Dim sOldCname 'computers current name

sOldCname = InputBox(“Enter computers current name”,“Windows Netdom Rename Script”)

If StrComp(sOldCname, “”) 0 Then

sNewCname = InputBox(“Enter computers new name”,“Windows Netdom Rename Script”)

If StrComp(sNewCname, “”) 0 Then

Call WSHShell.Run(“cmd.exe /K netdom renamecomputer " & sOldCname & " /newname:” & sNewCname & " /userd:<UserName> /passwordd:* /usero:<UserName> /passwordo:* /force ")

End If

End If

If anyone has a working fixlet please share…

Thanks

(imported comment written by SystemAdmin)

Did you restart the computer? Remember a name change on Windows will not be complete until the computer restarts