mikeylikesit Posted February 12, 2007 Share Posted February 12, 2007 Hey, I am new to autoit, and i love it! At the place that i work we need to change the names of computers quite often. i need a way to it in autoit. This is what i have: "$newname=InputBox ("Rename Computer", "Enter New Name: ", @ComputerName)" i was hoping i would be able to type in a REGWRITE to change the name of the computer but thats not working because i can find the value on the registry Can someone help me. All i need is a Prompt like what i have above that will change the name of the computer. any help would be great thanks Mike Hard work never killed anyone but why take the chance? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 12, 2007 Moderators Share Posted February 12, 2007 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
mikeylikesit Posted February 12, 2007 Author Share Posted February 12, 2007 i tried that, with no luck i can modify that but it does not show up under the "computer name" in my computer thanks for the help though Hard work never killed anyone but why take the chance? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 12, 2007 Moderators Share Posted February 12, 2007 i tried that, with no luck i can modify that but it does not show up under the "computer name" in my computer thanks for the help thoughIt works... Kinda have to restart Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
mikeylikesit Posted February 12, 2007 Author Share Posted February 12, 2007 i have tried this on windows xp pro as well as windows xp media center with no luck what am i doing wrong. i navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName i then modify "Computer name" to w/e i want and restart. on the restart the change will show up in regedit but not in my computer. Hard work never killed anyone but why take the chance? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 12, 2007 Moderators Share Posted February 12, 2007 i have tried this on windows xp pro as well as windows xp media center with no luck what am i doing wrong. i navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName i then modify "Computer name" to w/e i want and restart. on the restart the change will show up in regedit but not in my computer.Try changing this one:HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
mikeylikesit Posted February 12, 2007 Author Share Posted February 12, 2007 still not working, dont worry about it but if it ever crosses your mind let me know Thanks For the help Mike Hard work never killed anyone but why take the chance? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 12, 2007 Moderators Share Posted February 12, 2007 still not working, dont worry about it but if it ever crosses your mind let me knowThanks For the help MikeI just used the one above on 98 se and xp pro sp2 and it worked... no idea why it's not working for you. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Shevilie Posted February 12, 2007 Share Posted February 12, 2007 I tried to... and no name changes happened here Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Shevilie Posted February 12, 2007 Share Posted February 12, 2007 I found another place where the "old" name is mentioned HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam HKEY_CURRENT_USER\Software\Microsoft\Windows Media\WMSDK\General HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Tcpip\Parameters HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Services\Tcpip\Parameters HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\ShellNoRoam HKEY_USERS\S-1-5-18\Software\Microsoft\Windows\ShellNoRoam And stopped there.... might be more places Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
ihudson Posted February 12, 2007 Share Posted February 12, 2007 You might try using a tool that tracks registry changes or compares them. Then make the appropriate changes in the registry with your script. If there is a domain controller that the computer uses to authenticate the present user then you will have to add more steps, like first starting by logging on to the local machine, then changing the name. You usually will get prompted for the user that has rights to change the computer name (A domain Admin). Then a reboot is required to be re-registered on the domain. I think there are a few VB scripts on the net that do this, examine them and see what the steps are. Hope this expands your options. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 12, 2007 Moderators Share Posted February 12, 2007 Ya'll are making me lose my mind, I just tried it on 4 operating systems now (have to restart ) and they all worked. Dim $var = 'HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\', $Value While $Value = '' $Value = InputBox('Change Computer Name', 'Change Below') WEnd RegWrite($var, 'ComputerName', 'REG_SZ', $Value) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Danny35d Posted February 12, 2007 Share Posted February 12, 2007 You only need to change two registry key and reboot.The first one SmOke_N give it to you.HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerNameand the second one is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NV Hostname AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 12, 2007 Moderators Share Posted February 12, 2007 (edited) You only need to change two registry key and reboot.The first one SmOke_N give it to you.HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerNameand the second one is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NV HostnameYeah, but I don't think you have to change the tcpip hostname to change the computer name (at least I never have in the past). Edited February 12, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Danny35d Posted February 12, 2007 Share Posted February 12, 2007 You might try using a tool that tracks registry changes or compares them. Then make the appropriate changes in the registry with your script. If there is a domain controller that the computer uses to authenticate the present user then you will have to add more steps, like first starting by logging on to the local machine, then changing the name. You usually will get prompted for the user that has rights to change the computer name (A domain Admin). Then a reboot is required to be re-registered on the domain.I think there are a few VB scripts on the net that do this, examine them and see what the steps are.Hope this expands your options. I used the two regitry key in post #13 to change 1200 computer names in a domain.These are the step that I follow.1) Remove the computer from the domain into a workgroup2) Use the above registry key to change computer name3) Set the computer to autologon into administrator account. Optional changed administrator password.4) Reboot5) Run Netdom to join domain. I use Netdom because we have multiple OS (Winnt, Win2k and WinXp) to join domain using vb script only work in WinXP.6) Remove autologon7) Rebootdone. Good luck.... AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
ptrex Posted February 12, 2007 Share Posted February 12, 2007 @mikeylikesitMaybe this can give you a start.Dim $strComputer, $objWMIService, $colComputers, $objComputer, $strName $strComputer="." $objWMIService=ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colComputers=$objWMIService.ExecQuery("Select $* $from Win32_ComputerSystem") For $objComputer in $colComputers $Err = $objComputer.Rename ("NewNme") NextThis might be usefull as well.Computer Rename ToolHaven't tested it though.Enjoy !!ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
austinsr Posted February 16, 2007 Share Posted February 16, 2007 Hey, I am new to autoit, and i love it! At the place that i work we need to change the names of computers quite often. i need a way to it in autoit. This is what i have: "$newname=InputBox ("Rename Computer", "Enter New Name: ", @ComputerName)" i was hoping i would be able to type in a REGWRITE to change the name of the computer but thats not working because i can find the value on the registry Can someone help me. All i need is a Prompt like what i have above that will change the name of the computer. any help would be great thanks Mike Here is a bit of code that I am currently using in a project. It works fine. The machine does need rebooted after this is ran for the changes to show. Func Rename($name) RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName","REG_SZ", $name) RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $name) RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "Hostname", "REG_SZ", $name) RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $name) Return 0 EndFunc 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