In most cases, to update the configuration, the client application will need to get a session handle from the IANet_NetService class and store this handle in an IWbemContext context object. Changes to the configuration will only occur when the Apply method on the IANet_NetService is called. There are some exceptions to this requirement:
For some operations you can use the PreCheck qualifier in the context to check to see if an operation is allowed. This is to allow a user interface to disable certain controls or menu items if required.
Changing the adapter, team or VLAN:
To change an adapter, VLAN or Team setting, the client must first get the object path of the setting that it will change. This is best done by enumerating the settings on the object and storing the __PATH attribute of the setting (see above).
The easiest way for the client to update a setting is to:
The WMI Provider will validate the CurrentValue and return WBEM_E_FAIL if the validation failed. The exact reason for the failure will be returned in the Description attribute of the IANet_ExtendedStatus object.
Setting specific descriptions include:
The last description is returned when the current value for IANet_SettingEnum, IANet_SettingSlider or IANet_SettingMultiSelection is not one of the allowable values.
The only attribute for a setting that the client can change is CurrentValue. The WMI Provider will ignore changes made to any of the other values.
There are no supported methods on the setting class. To make changes to a setting modify the CurrentValue property, call PutInstance.
To create a new team, create an instance of IANet_TeamOfAdapters (i.e., use IWbemServices::GetObject() to get a class object for IANet_TeamOfAdapters and then use IWbemServices::SpawnInstance() to create an instance of this object).
Then, use IWbemClassObject::Put to set the TeamMode attribute in the instance to be the desired team type (e.g., AFT). Finally, call IWbemServices::PutInstance() to create the team, passing the flag WBEM_FLAG_CREATE_ONLY.
The object path for the new team is stored in the IWbemCallResultObject that is passed back to you when the call has completed. The method IWbemCallResult::GetResultString will get the new object path.
If this action fails, the client should check the IANet_ExtendedStatus to get the failure reasons.
The virtual IANet_EthernetAdapter and IANet_IPProtocolEndpoint classes for the team are not available until after the call to Apply. The settings for the team can be accessed using the IANet_Configuration object associated with the new IANet_TeamOfAdapters.
Adding an adapter to a team:
To add an adapter to a team, create an instance of IANet_TeamedMemberAdapter (i.e., use IWbemServices::GetObject() to get a class object for IANet_TeamedMemberAdapter and then use IWbemServices::SpawnInstance() to create an instance of this object).
The following attributes in the object must be set using IWbemClassObject::Put():
You can also set the priority for the adapter in the team. Finally, call IWbemServices::PutInstance() to add the adapter to the team, passing the flag WBEM_FLAG_CREATE_ONLY. If this action fails, check IANet_ExtendedStatus for the error code.
Removing an adapter from a team:
To remove an adapter from a team, delete the IANet_TeamedMemberAdapter instance that associates the adapter to the team using IWbemServices::DeleteInstance(). If this action fails, check IANet_ExtendedStatus for the error code.
Deleting a team:
To delete a team, delete the IANet_TeamOfAdapters instance using IWbemServices::DeleteInstance(). If this action fails, check IANet_ExtendedStatus to get the error code.
Changing the mode of a team:
To change the mode of a team, get the instance of IANet_TeamOfAdapters for the team (e.g., use IWbemServices::GetObject using the object path of the team). Then, use IWbemClassObject::Put to change the TeamMode attribute for the team. Finally, call IWbemClassObject:: PutInstance to tell the WMI Provider to update the team mode, passing the flag WBEM_FLAG_UPDATE_ONLY. If this action fails, check IANet_ExtendedStatus to get the error code.
Changing an adapter's priority within a team:
To change the priority of an adapter, the client should first get the instance of IANet_TeamedMemberAdapter for the adapter. (e.g. use IWbemServices::GetObject using the object path). The client can then use IWbemClassObject::Put to change the AdapterFunction attribute for the adapter. Finally the client needs to call IWbemClassObject:: PutInstance to tell the WMI Provider to update the adapter's priority. If this action fails, the client should check the IANet_ExtendedStatus for the error code.
Uninstalling an adapter:
To uninstall an adapter, call IWbemServices::DeleteInstance, passing the object path of the adapter to uninstall.
Creating a VLAN:
To create a VLAN, call the CreateVLAN method on the IANet_802dot1QVLANService for the adapter to which the VLAN is to be added. The following arguments must be passed to the method:
The function will return the object path of the newly created VLAN in the Out parameter VLANpath. If this action fails, check IANet_ExtendedStatus for the error code.
Changing the attributes of a VLAN:
The client can change the VLANNumber and VLANName attributes for a VLAN. To change the priority of an adapter, first get the instance of IANet_VLAN for the adapter (e.g. use IWbemServices::GetObject using the object path).
Then, change VLANNumber or VLANName to the desired values. Finally, call IWbemClassObject:: PutInstance to tell the WMI Provider to update the attributes, passing the flag WBEM_FLAG_UPDATE_ONLY. If this action fails, check the IANet_ExtendedStatus for the error code.
Deleting a VLAN:
To delete a VLAN, call IWbemServices::DeleteInstance passing the object path of the VLAN to delete.
Updating the boot agent:
The client can update the Boot Agent Image by using methods calls. To read/write flash image, first get the instance of IANet_BootAgent for the adapter (e.g., use IWbemServices::GetObject using the object path).
Then, execute ReadFlash() to read the existing flash boot ROM image or ProgramFlash() to update the flash boot ROM image. If this action fails, check the IANet_ExtendedStatus for the error code.
Task |
WMI methods |
Result |
Comments |
Update or Insert a boot ROM image for the adapter |
uint32
ProgramFlash(
|
If “Check Version” action is specified, this method will return with a warning message, if boot ROM image being updated as in NewFlashData[] is older than one already present on NIC.
If “Write” action is specified, this updates the FLASH ROM on the NIC with NewFlashData[]. |
This method is used to update the Flash ROM on the NIC. This will cause the NIC to stop communicating with the network while the flash is updated. |
Read boot ROM image |
uint32 ReadFlash( [OUT] uint8 FlashData[] ); |
FlashData[] contains the Flash ROM image on the NIC. |
This method reads the Flash ROM on the NIC which can be saved into a file. |
Copyright© 2002 Intel Corporation. Legal Information