Re: Change computername

Discussion in 'Python' started by Ian Kelly, Oct 17, 2012.

  1. Ian Kelly

    Ian Kelly Guest

    On Wed, Oct 17, 2012 at 8:07 AM, Anatoli Hristov <> wrote:
    > Hello,
    >
    > Can you please help me out how can I change the computername of
    > windows XP with or without the "WIN32" module ?


    Untested:

    from ctypes import *

    ComputerNamePhysicalDnsHostname = 5

    computer_name = u'COMPUTER'

    success = windll.kernel32.SetComputerNameExW(ComputerNamePhysicalDnsHostname,
    computer_name)
    if success:
    print("Name changed")
    else:
    print("Failed")

    The process will need admin rights, and the computer will need to be
    rebooted before the change will take effect.
    Ian Kelly, Oct 17, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anatoli Hristov

    Change computername

    Anatoli Hristov, Oct 17, 2012, in forum: Python
    Replies:
    0
    Views:
    101
    Anatoli Hristov
    Oct 17, 2012
  2. Anatoli Hristov

    Re: Change computername

    Anatoli Hristov, Oct 18, 2012, in forum: Python
    Replies:
    0
    Views:
    121
    Anatoli Hristov
    Oct 18, 2012
  3. Anatoli Hristov

    Re: Change computername

    Anatoli Hristov, Oct 18, 2012, in forum: Python
    Replies:
    0
    Views:
    115
    Anatoli Hristov
    Oct 18, 2012
  4. Chris Angelico

    Re: Change computername

    Chris Angelico, Oct 18, 2012, in forum: Python
    Replies:
    0
    Views:
    130
    Chris Angelico
    Oct 18, 2012
  5. Dennis Lee Bieber

    Re: Change computername

    Dennis Lee Bieber, Oct 18, 2012, in forum: Python
    Replies:
    0
    Views:
    115
    Dennis Lee Bieber
    Oct 18, 2012
Loading...

Share This Page