[This is preliminary documentation and subject to change.]
The IWbemLocator::ConnectServer method connects to CIMOM on the machine specified in the bstrNetworkResource parameter. This is typically a Microsoft® Windows NT® machine or a Microsoft® Windows® 95/98 target machine, which must have an operational CIMOM.
HRESULT IWbemLocator::ConnectServer(
[in] BSTR bstrNetworkResource,
[in] BSTR bstrUser,
[in] BSTR bstrPassword,
[in] BSTR bstrLocale,
[in] long lSecurityFlags,
[in] BSTR bstrAuthority,
[in] IWbemContext *pCtx,
[out] IWbemServices **ppNamespace
);
For access to the default namespace on a remote machine using Distributed COM (DCOM) or Microsoft-compatible networking, include the machine name: "\\myserver\root\default".
See Object Paths.
For example, American English would appear as "MS\\0x409" (C++ requires two backslashes because the first is considered an escape character).
The string format is required since WBEM accommodates other localization schemes besides Microsoft 32-bit LCIDs, such as ISO 639 or RFC 1766. See WBEM Localization Guidelines.
If you use WBEM_AUTHENTICATION_DEFAULT, bstrUser, bstrPassword, and bstrAuthority must remain NULL. In this case, log on using the currently logged-on Windows NT LanMan user. If that fails, try the WBEM Guest account (an anonymous logon). If both fail, the user is denied access.
If you use WBEM_AUTHENTICATION_NTLM, set bstrUser and bstrPassword to the desired Windows NT LanMan Domain account and password. Set the bstrAuthority parameter to the LanMan Domain name to which the user account belongs.
If WBEM_AUTHENTICATION_WBEM is specified, set bstrUser and bstrPassword to a valid WBEM user name and its corresponding password. bstrAuthority can be set to either "WBEM" or NULL.
WBEM_E_ACCESS_DENIED | The current or specified user name and password were not valid or authorized to make the connection. |
WBEM_E_FAILED | Other unspecified errors. |
WBEM_E_INVALID_NAMESPACE | The specified namespace did not exist on the server. |
WBEM_E_INVALID_PARAMETER | An invalid parameter was specified, or the namespace could not be parsed. |
WBEM_E_OUT_OF_MEMORY | There was not enough memory to complete the operation. |
WBEM_E_TRANSPORT_FAILURE | A networking error occurred, preventing normal operation. |
WBEM_E_SERVER_NOT_FOUND | The specified server could not be located. |
WBEM_NO_ERROR | Success. |