Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
They have a WMI provider \root\IntelNCS
. Note this must be installed inorder to run this code.
The NCS WMI Provider is a set of software components that implements the Intel WMI network classes. For more about this provider see: http://www.snc.com.tr/ftp/Mastory%20TX%20&%20HX/LAN/PRO100/DOCS/XP64/wmi_nic2.htm
The Intel® PRO Network Adapters WMI Provider are installed as part of Intel® PROSet software installation. See the Installing Intel® PROSet section for more information on how to install Intel® PROSet.
Intel® PROSet Typical Setup Type registers the Intel® PRO Network Adapters WMI Provider into the root\IntelNCS namespace. To register Intel® PRO Network Adapters WMI Provider into the Microsoft standard root\cimv2 namespace use Custom Setup Type and choose WMI CIMv2 Support.
Reference: http://www.intel.com/support/network/sb/cs-016040.htm
********************************************************* ********************UNDEBUGGED CODE********************** **************** USE AT YOUR OWN RISK ******************* ********************************************************* ; PURPOSE: This script takes a command line setting for speed/duplex and ; applies it to all adapters on a system, by default. If the command line supplied ; setting is the same as the current setting, an apply will not be executed. #DefineFunction ExecApply(wbemServices, strNetSerObjPath, SessionObject) Message("", "Executing apply...") NetServiceObject = wbemServices.Get(strNetSerObjPath) FinalTargetobj = NetServiceObject.ExecMethod_("Apply", SessionObject) Return 1 #EndFunction #DefineFunction ReleaseHandle(wbemServices, strNetSerObjPath, SessionObject) Message("", "Releasing Session Handle") NetServiceObject = wbemServices.Get(strNetSerObjPath) FinalTargetobj = NetServiceObject.ExecMethod_("ReleaseSessionHandle", SessionObject) Return 1 #EndFunction #DefineFunction PrintUsage() msg = "" msg = StrCat(msg, " Usage: FSDSet.WBT keyword ",@CRLF) msg = StrCat(msg, " Keyword is required and is valid Speed/Duplex setting.",@CRLF) msg = StrCat(msg, " Valid Speed/Duplex settings are:",@CRLF) msg = StrCat(msg, " 0 = AutoDetect, 1 = 10-Half Duplex, 2= 10-Full Duplex",@CRLF) msg = StrCat(msg, " 3 = 100-Half Duplex, 4 = 100-Full Duplex, 5 = 1000 Full Duplex.",@CRLF) Message("",msg) Return 1 #EndFunction FOR_READING = 1 strComputer = "." If param0 == 0 PrintUsage() bErr = @TRUE Else argTest = StriCmp("string012345", param1) If argTest <> 0 strFSDSet = param1 wbemServices = GetObject(StrCat("winmgmts:{impersonationLevel=impersonate}\\", strComputer , "\root\IntelNCS")) olIANetServices = wbemServices.InstancesOf("IANet_NetService") colAdapters = wbemServices.InstancesOf("IANet_EthernetAdapter") SValueSet = CreateObject("WbemScripting.SWbemNamedValueSet") IANet_NetServiceClassDescription = wbemServices.Get("IANet_NetService") SessionObject = IANet_NetServiceClassDescription.Methods_.Item("Apply").InParameters.SpawnInstance_() NetServiceSet = wbemServices.InstancesOf("IANet_NetService") ForEach NetServiceObject In NetServiceSet ; SWbemObjectSet strNetSerObjPath = NetServiceObject.Path_.Path ;Save the path for later use ServiceObject = NetServiceObject.ExecMethod_("GetSessionHandle") cstring = ServiceObject.SessionHandle SessionObject.SessionHandle = cstring Next ForEach objIANetService In colIANetServices strNSPath = objIANetService.Path_.Path objInParams = objIANetService.Methods_("Apply").inParameters.SpawnInstance_() strSH = SessionObject.SessionHandle SValueSet.Add("SessionHandle", strSH) objInParamsProps = objInParams.Properties_ objInParams.Properties_.Add("SessionHandle",8).Value=strSH objInParamsProps = objInParams.Properties_ Next ForEach objAdapter In colAdapters If StriCmp(StrSub(objAdapter.Caption, 1, 4), "Team") <> 0 strAdapterPath = objAdapter.Path_.Path strQuery = StrCat("ASSOCIATORS OF {" , strAdapterPath , "} WHERE ResultClass=IANet_Configuration") colIAConfig = wbemServices.ExecQuery(strQuery,,,SValueSet) Message("Checking settings on " , objAdapter.Caption) ForEach objIAConfig In colIAConfig strConfigPath = objIAConfig.Path_.Path strQuery = StrCat("ASSOCIATORS OF {" , strConfigPath , "} WHERE AssocClass=IANet_SettingContext") colIASettings = wbemServices.ExecQuery(strQuery,,,SValueSet) ForEach objIASetting In colIASettings If objIASetting.Caption = "SpeedDuplex" arrPossVal = objIASetting.PossibleValues list = "" For xx = 1 To ArrInfo(arrPossVal, 1) list = ItemInsert(arrPossVal[xx-1], -1, list, " ") Next posVals = StrCat("temp ", list) strTest = StrIndex (posVals, param1, 1, @FWDSCAN) If strTest > 0 If objIASetting.CurrentValue <> strFSDSet objIASetting.CurrentValue = strFSDSet Message( "Setting SpeedDuplex to " , StrCat( param1, "...")) result = objIASetting.Put_(131072, SValueSet) Message( "New value is " , objIASetting.CurrentValue) bDoApply = @TRUE Else Message( "Current value is already " , param1) EndIf EndIf EndIf Next Next EndIf Next Else Message("Notice", "This script must be run with a valid Speed/Duplex setting") PrintUsage() bErr = @TRUE EndIf If bDoApply = @TRUE ExecApply(wbemServices, strNetSerObjPath, SessionObject) EndIf If bErr <> @TRUE ReleaseHandle(wbemServices, strNetSerObjPath, SessionObject) EndIf End If
Article ID: W17324
File Created: 2007:07:03:14:29:30
Last Updated: 2007:07:03:14:29:30