andyvl Posted August 30, 2007 Posted August 30, 2007 Is there a quick way to change a computername with autoIt script? (I need to have the computername equal as the loged on user. so something like @computername = $userid (pay attention that I use the userid as written in the registry, cause my script runs as a service, otherwise I have 'system' as user.
ashley Posted August 30, 2007 Posted August 30, 2007 Is there a quick way to change a computername with autoIt script?(I need to have the computername equal as the loged on user.so something like @computername = $userid(pay attention that I use the userid as written in the registry, cause my script runs as a service, otherwise I have 'system' as user.if u want the real suer name use @username = @computername $test = @username = @computername MsgBox(0, "test", $test)not tested Free icons for your programs
Gif Posted August 30, 2007 Posted August 30, 2007 i think you should search the registry and then regwrite,i am not sure if this is what you want but look at HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\(Default)
BigDod Posted August 30, 2007 Posted August 30, 2007 Have a look at This article from Microsoft Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
PsaltyDS Posted August 30, 2007 Posted August 30, 2007 Have a look at This article from Microsoft I hope he means to rename the My Computer icon, and not the computer, after the current user name... cause that's just... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
xwing1978 Posted August 30, 2007 Posted August 30, 2007 The machine name can also be changed using WMI.Here's a link to a Microsoft page where I found out how to do it: from http://msdn2.microsoft.com/en-us/library/aa393056.aspxSee attached file for sample functions.There are four functions in the file: Computer_Rename( $sComputerName, $sLocalUser, $sPassword ) Computer_AddToDomainOrWorkgroup( $sDomain, $sDomainUsername, $sPassword ) Computer_RemoveFromDomain( $sDomainUsername, $sPassword ) Computer_MemberOfDomainOrWorkgroup( )Enjoy!Func_Computer.au3
andyvl Posted August 30, 2007 Author Posted August 30, 2007 hmm, is not working. I did the script first showed current computername change computername to another showed new computerame. (but it's still the same) also after a gpforce /update the name hasn't changed. And yes it is indeed needed for a project that the computername changes to the name of the user logged on to it. (registry value also didn't seemed to work) and it need to be done without installing extra components in windows. thx for your support and help so far, but it wasn't correct. Please any other idea or suggestion
Anteaus Posted August 30, 2007 Posted August 30, 2007 And yes it is indeed needed for a project that the computername changes to the name of the user logged on to it.Don't have an answer, but occurs to me that since the computername is used by many services that start before logon, a change to the computername almost certainly requires a reboot. (and hence user-logoff) Thus, is the scheme feasible anyway? An alternative might be to change the computer's descriptive text. Would that be of any use?
Danny35d Posted August 30, 2007 Posted August 30, 2007 The script below is what I use to rename the computer name._RenameComputerName($userid) Func _RenameComputerName($sComputerName) If Not RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName","REG_SZ", $sComputerName) Then Return(1) If Not RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName", "REG_SZ", $sComputerName) Then Return(1) If Not RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "Hostname", "REG_SZ", $sComputerName) Then Return(1) If Not RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "NV Hostname", "REG_SZ", $sComputerName) Then Return(1) Return(0) EndFuncJust to let you know after using the script you need to reboot otherwise you still see the old computername.Note: I don't know what you project is about, but once you rename the computer if the computer belong to a domain you won't be able to log back in using any user account. The only way to login is using the administrator account only.xwing1978 nice scirpt thank you for sharing. The only thing is Computer_AddToDomainOrWorkgroup( ) Computer_RemoveFromDomain() wmi won't work in windows 2000. AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
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