After you retrieve a pointer to an
IWbemServices proxy, you must set the security on the proxy to access WMI through the proxy. You must set the security because the
IWbemServices proxy grants access to an out-of-process object. In general, COM security does not allow one process to access another process if you do not set the proper security properties. For more information, see
Setting the Security on IWbemServices and Other Proxies. Connections to different operating systems require varying levels of authentication and impersonation. For more information, see Connecting to WMI on a Remote Computer.
The code examples in this topic require the following references and #include statements to compile correctly.
#define _WIN32_DCOM
#include <iostream>
using namespace std;
#include <wbemidl.h>
# pragma comment(lib, "wbemuuid.lib")
The following procedure describes how to set the security levels on a WMI connection.
To set the security levels on a WMI connection
After you set the security levels for your
IWbemServices pointer, you can access the various capabilities of WMI. After you finish using WMI, you must shut down your application. For more information, see
Cleaning up and Shutting Down a WMI Application.
Send comments about this topic to Microsoft
Build date: 6/15/2009