' comments ' comments ' %comspec% /c reg query "\\hostname\HKlm\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards" /s ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\2 ' ServiceName REG_SZ {3C3E369D-EC00-4782-832C-4A5AA4A9A3EC} ' Description REG_SZ Intel(R) PRO/1000 MT Network Connection ' ' %comspec% /c reg query "\\hostname\HKLM\SOFTWARE\Microsoft\EAPOL\Parameters" /s ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EAPOL\Parameters\General ' InterfaceList REG_SZ \DEVICE\{3C3E369D-EC00-4782-832C-4A5AA4A9A3EC} ' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EAPOL\Parameters\General\Global Dim wshnetwork, strBoxname strTarget = GetCmdlineArgs() ' set auth and supplicant mode SuppUpdate = "reg add " & strTarget & "HKLM\SOFTWARE\Microsoft\EAPOL\Parameters\General\Global /f /v AuthMode /t REG_DWORD /d 2" strUpdateStatus = RunCommand(SuppUpdate) If instr(strUpdateStatus,"success") > 0 Then WScript.Echo "ok:authmode=2" Else Err.Raise 100 End If SuppUpdate = "reg add " & strTarget & "HKLM\SOFTWARE\Microsoft\EAPOL\Parameters\General\Global /f /v SupplicantMode /t REG_DWORD /d 3" strUpdateStatus = RunCommand(SuppUpdate) If instr(strUpdateStatus,"success") > 0 Then WScript.Echo "ok:supplicantmode=3" Else Err.Raise 200 End If strIFQuery = "%comspec% /c reg query " & Chr(34 ) & strTarget & "HKlm\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards" & Chr(34) & " /s" strCMDResults = RunCommand(strIFQuery) arrCMDResults = Split(strCMDResults,"^") 'harvest the interface names index = 0 Do While index < UBound(arrCMDResults) strIntCandidate = arrCMDResults(index) If InStr(strIntCandidate,"ServiceName") > 0 Then If Len(strInterfaces) > 0 Then strInterfaces = strInterfaces & "^" End If strInterfaces = strInterfaces & right(strIntCandidate, Len(strIntCandidate)-InStr(strIntCandidate,"{")+1) End If index = index+1 Loop arrInterfaces = Split(strInterfaces,"^") For i = 0 To UBound(arrInterfaces) strInterface = arrInterfaces(i) ' WScript.Echo strInterface ' all interfaces known ' update key With supplicant config strUpdateStatus = UpdateIFSupplicant(strTarget,strInterface) If instr(strUpdateStatus,"ok") = 0 Then Err.Raise 300 Exit For End If Next Function UpdateIFSupplicant(strTarget,strInterface) SuppUpdate = "reg add " & strTarget & "HKLM\SOFTWARE\Microsoft\EAPOL\Parameters\Interfaces\" & _ strInterface & " /f /v 1 /t REG_BINARY /d " & _ "0500000000000000000000c019000000200000001122331122331122331122331122331122" & _ "3311223311223311223311223311220d000000280000000000000028000000050000000000" & _ "00000000000000000000000000000000000000000000000000000000000019000000560000" & _ "0001000000560000000100000000000000010000002d000000170000000100000014000000" & _ "7a74410fb0cd5c972a364b71bf031d88a6510e9e000001000000170000001a000000010000" & _ "0002000000000000000000000000000000" ' WScript.Echo SuppUpdate strUpdateStatus = RunCommand(SuppUpdate) If instr(strUpdateStatus,"success") > 0 Then WScript.Echo "ok:configured_interface:" & strInterface UpdateIFSupplicant = "ok" End if End Function Function GetCmdlineArgs() strTargetHost = WScript.Arguments.Named.Item("boxname") If Len(strTargetHost) = 0 Then WScript.Echo "operating on localhost" GetCmdlineArgs = "" Else GetCmdlineArgs = "\\" & WScript.Arguments.Named.Item("boxname") & "\" End If End Function Function RunCommand(strCommandString) On Error Resume Next WScript.Echo strCommandString set objWS=WScript.CreateObject("WScript.Shell") Set objExecObject = objWS.Exec(strCommandString) If Err.Number <> 0 Then WScript.Echo CStr(Err.Number) & Err.description End If Do While Not objExecObject.StdOut.AtEndOfStream strCMDResult = objExecObject.StdOut.ReadLine() if Len(strCMDResult) > 0 Then valOutIndex = valOutIndex + 1 If valOutIndex > 1 then RunCommand = RunCommand & "^" End If RunCommand = RunCommand & strCMDResult End If Loop set objWS = Nothing End Function