Jump to content

Set computer name


Recommended Posts

Hello!

I want to change the computer name but I don't know how. I've looked through the entire help file but did not find solution. Would you please help me?

Also I want to ask another thing. @Computername returns the computername so I thought that if I find where the macros get their values I'll find out how to change the computername but I couldn't find where the macros are defined. Can I see the definitions of the macros?

Thank you for your time

p.p. sorry for my english

i'm trying to improve it

I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Link to comment
Share on other sites

  • Moderators

Look at the "@" symbol under "Index" in the help file for the macro names and defs.

Also... If you can't find it in help, try the Advanced Search Feature of the forum.

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

thanks

when I asked about the macro defs I didn't mean their description but how they get their values (something like @Computername=something)

anyway - thank you

I've found solution

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)
EndFunc

by Danny35d

I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Link to comment
Share on other sites

  • Moderators

thanks

when I asked about the macro defs I didn't mean their description but how they get their values (something like @Computername=something)

anyway - thank you

I've found solution

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)
EndFunc

by Danny35d

K, yeah... I have a list of those myself for another language.

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...