PC Review


Reply
Thread Tools Rate Thread

WMI NIC Power Manangment option

 
 
New Member
Join Date: Jul 2009
Posts: 1
 
      28th Jul 2009
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NIC Bonding (NIC-B) vs NIC Teaming (NIC-T) Charles L. Phillips Windows XP Basics 0 7th Jan 2008 09:45 PM
"Win32_Processor: WMI: Access denied" and "Win32_OperatingSystem: WMI: Access denied" Mark Jennings Windows XP WMI 3 29th Dec 2004 05:18 PM
Change the one of the option of power management using WMI Peter S. Microsoft Windows 2000 Networking 0 20th Feb 2004 02:46 PM
Re: WMI Error : Unable to connect to wmi service "root\cimv2" wil_riker01 Windows XP Networking 0 11th Feb 2004 10:55 PM
C++ Wmi App to C# Wmi App - System.Mgmt Access Jerry Microsoft C# .NET 1 9th Jul 2003 09:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:03 AM.