Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; '"win32"': 0.09; 'effect.': 0.09; 'success:': 0.09; 'oct': 0.16; 'rights,': 0.16; 'subject:Change': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'admin': 0.18; 'windows': 0.19; 'module': 0.19; 'import': 0.21; 'ctypes': 0.22; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'hello,': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'success': 0.63; 'skip:w 60': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Ra5SZb0P+j63zn3x+34o519iwEh4g2h8WXbhwnGRzzc=; b=AXqbKQzhjgkkH/XdAMt4qpGHTuGQkJPQQ21PmKSBCjKoET02pNkI3DAd7Skszjfh1U MnXdK6ZjJVh4i3p3Pb36hJjd0IVatnpBT8OVpnjxYFmD5AKWnUqy5XNO2oNXvSLHitHp UKZrQPpggq64xTQFNY23WGxFcjc8uxgnlagFX8LAJWaKKNCq7RdQ2fkocvdLz7Gs0/J7 RcJOl/WJXHAllu1CPjHPFb+onaNtVYl4sEaPhw7sAVxKs3rfQlq3xn9ePo0BSo0a/jDE KpK5hdUPGFOLsY4RPAgKVt+ySOpIyuaAN22rsyomGOirIhAcemiKyMIpX8m1vxybDuJk pY/Q== MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Wed, 17 Oct 2012 11:47:12 -0600 Subject: Re: Change computername To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350496064 news.xs4all.nl 6855 [2001:888:2000:d::a6]:54479 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31528 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.