public class WinApi extends Object
| Constructor and Description |
|---|
WinApi() |
| Modifier and Type | Method and Description |
|---|---|
static void |
api(Consumer<WinApi> client)
Выполнение кода в контексте wmi
|
static <R> R |
api(Function<WinApi,R> client)
Выполнение кода в контексте wmi
|
void |
wmi(Consumer<Wmi> wmi)
Соединение с wmi по умолчанию
,более детально см
wmi(String, String, String, String, String, String, Consumer) |
void |
wmi(String host,
Consumer<Wmi> client)
Соединение с wmi по умолчанию,
более детально см
wmi(String, String, String, String, String, String, Consumer) |
void |
wmi(String host,
String namespace,
Consumer<Wmi> client)
Соединение с wmi по умолчанию
,более детально см
wmi(String, String, String, String, String, String, Consumer) |
void |
wmi(String host,
String namespace,
String user,
String password,
Consumer<Wmi> client)
Соединение с wmi по умолчанию,
более детально см
wmi(String, String, String, String, String, String, Consumer) |
void |
wmi(String host,
String namespace,
String user,
String password,
String locale,
Consumer<Wmi> client)
Соединение с wmi по умолчанию,
более детально см
wmi(String, String, String, String, String, String, Consumer) |
void |
wmi(String host,
String namespace,
String user,
String password,
String locale,
String authority,
Consumer<Wmi> client)
Работа с wmi api.
|
protected void |
wmi0(String host,
String namespace,
String user,
String password,
String locale,
String authority,
Consumer<Wmi> client) |
public static void api(Consumer<WinApi> client)
client - кодpublic static <R> R api(Function<WinApi,R> client)
client - кодpublic void wmi(Consumer<Wmi> wmi)
wmi(String, String, String, String, String, String, Consumer)wmi - клиентский кодpublic void wmi(String host, Consumer<Wmi> client)
wmi(String, String, String, String, String, String, Consumer)host - хостclient - клиентский кодpublic void wmi(String host, String namespace, Consumer<Wmi> client)
wmi(String, String, String, String, String, String, Consumer)host - хостnamespace - пространствоclient - клиентский кодpublic void wmi(String host, String namespace, String user, String password, Consumer<Wmi> client)
wmi(String, String, String, String, String, String, Consumer)host - хостnamespace - пространствоuser - пользовательpassword - парольclient - клиентский кодpublic void wmi(String host, String namespace, String user, String password, String locale, Consumer<Wmi> client)
wmi(String, String, String, String, String, String, Consumer)host - хостnamespace - пространствоuser - пользовательpassword - парольlocale - локальclient - клиентский кодpublic void wmi(String host, String namespace, String user, String password, String locale, String authority, Consumer<Wmi> client)
Error codes
After the completion of the ConnectServer method, the Err object may contain one of the error codes in the following list.
The current or specified user name and password were not valid or authorized to make the connection.
Unspecified error.
The specified namespace did not exist on the server.
An invalid parameter was specified, or the namespace could not be parsed.
Not enough memory to complete the operation.
A networking error occurred, preventing normal operation.
host - хост, '.' - текущий хост.
Computer name to which you are connecting. If the remote computer is in a different domain than the user account under which you log in, then use the fully qualified computer name. If you do not provide this parameter, the call defaults to the local computer.
Example: server1.network.fabrikam
You also can use an IP address in this parameter. If the IP address is in IPv6 format, the target computer must be running IPv6. An address in IPv4 looks like 111.222.333.444
An IP address in IPv6 format looks like 2010:836B:4179::836B:4179
For more information on DNS and IPv4, see the Remarks section.
namespace - пространство имен wmi:
Example: "root\CIMV2"
user - User name to use to connect.
The string can be in the form of either a user name or a Domain\Username.
Leave this parameter blank to use the current security context.
The strUser parameter should only be used with connections to remote WMI servers.
If you attempt to specify strUser for a local WMI connection, the connection attempt fails.
If Kerberos authentication is in use, then the username and password that is specified in strUser and strPassword cannot be intercepted on a network.
You can use the UPN format to specify the strUser.
Example: "DomainName\UserName"
Note
If a domain is specified in strAuthority, then the domain must not be specified here. Specifying the domain in both parameters results in an Invalid Parameter error.
password - String that specifies the password to use when attempting to connect.
Leave the parameter blank to use the current security context.
The strPassword parameter should only be used with connections to remote WMI servers.
If you attempt to specify strPassword for a local WMI connection, the connection attempt fails.
If Kerberos authentication is in use then the username and password that is specified
in strUser and strPassword cannot be intercepted on the network.authority - String that specifies the localization code.
If you want to use the current locale, leave it blank.
If not blank, this parameter must be a string that indicates the desired locale where information must be retrieved.
For Microsoft locale identifiers, the format of the string is "MS_xxxx", where xxxx is a string in the hexadecimal form that indicates the LCID.
For example, American English would appear as "MS_409".
strAuthority [in, optional]
""
This parameter is optional. However, if it is specified, only Kerberos or NTLMDomain can be used.
Kerberos:
If the strAuthority parameter begins with the string "Kerberos:", then Kerberos authentication is used and this parameter should contain a Kerberos principal name.
The Kerberos principal name is specified as Kerberos:domain, such as Kerberos:fabrikam where fabrikam is the server to which you are attempting to connect.
Example: "Kerberos:DOMAIN"
NTLMDomain: To use NT Lan Manager (NTLM) authentication, you must specify it as NTLMDomain:domain, such as NTLMDomain:fabrikam where fabrikam is the name of the domain.
Example: "NTLMDomain:DOMAIN"
If you leave this parameter blank, the operating system negotiates with COM to determine whether NTLM or Kerberos authentication is used.
This parameter should only be used with connections to remote WMI servers.
If you attempt to set the authority for a local WMI connection, the connection attempt fails.
Note
If the domain is specified in strUser, which is the preferred location, then it must not be specified here. Specifying the domain in both parameters results in an Invalid Parameter error.
client - клиентский кодCopyright © 2020. All rights reserved.