Set WSHShell=WScript.CreateObject("WScript.Shell")
Dim NetcardDescription
Dim NetcardName
if Wscript.Arguments.Count<2 then
Wscript.Quit()
End if
NetcardDescription=Wscript.Arguments(0)
NetcardName=Wscript.Arguments(1)
Set objWMIService = Getobject("winmgmts:\\.\root\cimv2")
Set objNetworks = objWMIService.execQuery("Select * From Win32_NetworkAdapterConfiguration ")
For Each objNetwork In objNetworks
if Instr(objNetwork.Description,NetcardDescription)=1 Then
NetcardGuid=objNetwork.SettingID
RegPath="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\"&NetcardGuid &"\Connection\"
DataType="REG_SZ"
Call ValueAdd("Name",NetcardName)
End if
Next
Function ValueAdd(KeyName,KeyData)
WSHShell.RegWrite RegPath&KeyName,KeyData,DataType
End Function
Wscript.Quit()