title: Set local computer name and static IP address on systems running on Windows 10
body: <p>I am trying to rename computers and assign them a static IP by running a VBScript.
  Name and IP will be read from a text file.</p>
  
  <p>I have successfully used the scripts below on Windows&nbsp;7 but it doesn't work on Windows&nbsp;10</p>
  
  <p>To rename Windows&nbsp;7 computers:</p>
  
  <pre><code>strComputer = "."
  Set objWMIService = GetObject("winmgmts:" _
      &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\cimv2")
  
  Set colComputers = objWMIService.ExecQuery _
      ("Select * from Win32_ComputerSystem")
  
  Dim objComputer 'as Win32_ComputerSystem
  For Each objComputer In colComputers
      err = objComputer.Rename("NewName")
  Next
  </code></pre>
  
  <p>To set Windows&nbsp;7 static IP:</p>
  
  <pre><code>Set colNetAdapters = objWMIService.ExecQuery _
      ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
  
  strIPAddress = Array("192.168.1.xxx")
  strSubnetMask = Array("255.255.255.x")
  strGateway = Array("192.168.1.xxx")
  strGatewayMetric = Array(1)
  </code></pre>
  
  <p>I can't find a version of that script that would works on Windows 10.</p>