WMI NIC Power Manangment option

Joined
Jul 28, 2009
Messages
1
Reaction score
0
Can some one give me exact interpretation of below mention line which is in VBScript into
WMI C++ line.

Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate,(LoadDriver)}//" & sComputer & "\root\WMI").

I am not able to give "LoadDriver" in WMI.

My requriment is , i want to enable "Allow the computer to turnoff this device to save power" for Network Interface Card.

here is my code snippet



hr = CoCreateInstance( CLSID_WbemAdministrativeLocator, NULL,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, reinterpret_cast< void** >( &locator ) );

hr = locator->ConnectServer(L"root\\WMI",NULL, NULL, NULL,
WBEM_FLAG_CONNECT_USE_MAX_WAIT,
NULL, NULL,&LocalWMIPowerDevices);


hr = CoSetProxyBlanket(
LocalWMIPowerDevices, // Indicates the proxy to set
RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx
RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx
NULL, // Server principal name
RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx
RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx
NULL, // client identity
EOAC_NONE // proxy capabilities
);

hr = LocalWMIPowerDevices->ExecQuery( L"WQL", L"Select * From MSPower_DeviceEnable",
WBEM_FLAG_FORWARD_ONLY, NULL, &Devices_enumerator );



hr = Device_Object->Put(L"Enable", 0, &varValue,NULL); <--- Want to set check box.


But unfortunatly It does not work ?

any help will be appriciated

Regards
Harshal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top