Set args = WScript.Arguments eth0Mac = args(0) ' Strip out periods and dashes eth0Mac = Replace(eth0Mac,".","") eth0Mac = Replace(eth0Mac,"-","") ' Add the dashes between the octets WScript.Echo eth0Mac eth0Mac = Mid(eth0Mac,1,2)+"-"+Mid(eth0Mac,3,2)+"-"+Mid(eth0Mac,5,2)+"-"+Mid(eth0Mac,7,2)+"-"+Mid(eth0Mac,9,2)+"-"+Mid(eth0Mac,11,2) eth0Mac = UCase(eth0Mac) WScript.Echo "Eth0:" + eth0Mac ' Get the current IP Configuration ipconf = getCommandOutput("ipconfig /all") ipConfLines = Split(ipconf, vbCrLf) ' Parse through each line and get the interfaces and their MAC Addresses Dim line, line2 For i = 1 to UBound(ipConfLines) Step 1 line = ipConfLines(i) If InStr(line, "Ethernet adapter") Then WScript.Echo line ' Now we found the adapter, find the physical addres For j = i to UBound(ipConfLines) Step 1 line2 = ipConfLines(j) If InStr(line2, "Physical Address") Then WScript.Echo line2 Dim adapter, mac start = Len("Ethernet adapter ") adapter = Mid(line, start, Len(line) - start) mac = Mid(line2, InStr(line2, ":") + 2) ' If this is the Private MAC, set to the private network If mac = eth0Mac Then netsh = getCommandOutput("netsh interface set interface name=""" + adapter + """ newname=""Private""") 'netsh = getCommandOutput("netsh interface set interface name=""" + adapter + """ newname=""Local Area Connection""") WScript.Echo netsh Else netsh = getCommandOutput("netsh interface set interface name=""" + adapter + """ newname=""Public""") 'netsh = getCommandOutput("netsh interface set interface name=""" + adapter + """ newname=""Local Area Connection 2""") WScript.Echo netsh End If Exit For End If Next End If ' WScript.Echo line Next Function getCommandOutput(theCommand) Dim objShell, objCmdExec Set objShell = CreateObject("WScript.Shell") Set objCmdExec = objShell.exec(theCommand) getCommandOutput = objCmdExec.StdOut.ReadAll End Function