stev379 Posted February 20, 2005 Share Posted February 20, 2005 I haven't found a way to rename the local computer in AutoIT. Is there a function available for this? Link to comment Share on other sites More sharing options...
Flashz Posted February 21, 2005 Share Posted February 21, 2005 I haven't found a way to rename the local computer in AutoIT. Is there a function available for this?<{POST_SNAPBACK}>You can download compname.exe at http://www.willowhayes.co.uk/It allows you to rename a PC using command line. You can use it in your script to prompt for a Computername and pass the appropriate commandline. You will have to reboot for the changes to take effect. Link to comment Share on other sites More sharing options...
dtilley Posted April 11, 2005 Share Posted April 11, 2005 You could also find the appropriate registry entries (ComputerName in Win9x) and use the RegWrite command to change them. Link to comment Share on other sites More sharing options...
Puckmeister Posted April 12, 2005 Share Posted April 12, 2005 (edited) hi, i hope this can help you, i wrote it a few months ago. it changes the computername, and asks if you want to reboot or not. i think it`s not perfect but it works. oh, please excuse my bad english.... expandcollapse popup$name1 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName" $name2 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters" $name3 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" $name4 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" $rebootok = 0 $actualname = EnvGet("COMPUTERNAME") $antwort = InputBox ( "Change Computername", "Actual Name: " & $actualname & @CRLF & @CRLF & "Type the new name if you want to change. Needs a reboot to activate.", $actualname, "") If $antwort = $actualname Then $tray_title = "Computername not changed !" $tray_prompt1 = "The name ist the same as the actual name." $tray_prompt2 = "No change required !" ElseIf $antwort = "" Then $tray_title = "Computername not changed !" $tray_prompt1 = "Cancelled" $tray_prompt2 = "" Else $antwort2 = MsgBox(36, "Confirm change of Computername", "New Name " & $antwort & " ?") If $antwort2 = 6 Then RegWrite($name1,"ComputerName","REG_SZ",$antwort) RegWrite($name2,"NV Hostname","REG_SZ",$antwort) RegWrite($name3,"ComputerName","REG_SZ",$antwort) RegWrite($name4,"NV Hostname","REG_SZ",$antwort) $reboot = MsgBox(36, "Computername written to system", "Reboot now ?") If $reboot = 6 Then $rebootok = 1 $tray_title = "Computername changed !" $tray_prompt1 = "Prepare for Reboot." $tray_prompt2 = "Name after Reboot: " & @CRLF & $antwort ElseIf $reboot = 7 Then $rebootok = 0 $tray_title = "Computername changed !" $tray_prompt1 = "No Reboot for now" $tray_prompt2 = "Name after Reboot: " & @CRLF & $antwort EndIf ElseIf $antwort2 = 7 Then $tray_title = "Computername not changed !" $tray_prompt1 = "Changed your mind ?" $tray_prompt2 = "You don`t like " & $antwort & ", hmmmm ?!??!?!?" EndIf EndIf TrayTip ( $tray_title, $tray_prompt1 & @CRLF & $tray_prompt2,"",1) sleep (3000) If $rebootok = 1 Then Shutdown ( 2 ) EndIf Edited April 12, 2005 by sirhc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now