リモートの Windows Server 2012 マシンを wmi4j に接続しようとしていますが、「アクセスが拒否されました」というエラーが発生します。しかし、このリモート マシンを WMI Explorer 2016 プログラムに正常に接続できます。
これがコードです。
private static String server = "****";
private static String username = "**\\Administrator";
private static String password = "pass";
private static String namespace = "root\\cimv2";
SWbemLocator locator = new SWbemLocator(server,username,password,namespace);
SWbemServices services = locator.connectServer(); //this line throws exception
また、すべての許可を与えます ( https://social.technet.microsoft.com/Forums/office/en-US/4f33837b-1cb1-4648-85b1-3ba87cbfe93e/wmi-remote-access-denied?forum=winserverManagement )
編集:スタックトレース;
cn.chenlichao.wmi4j.WMIException: Access is denied, please check whether the [domain-username-password] are correct. Also, if not already done please check the GETTING STARTED and FAQ sections in readme.htm. They provide information on how to correctly configure the Windows machine for DCOM access, so as to avoid such exceptions. [0x00000005]
at cn.chenlichao.wmi4j.SWbemLocator.connectServer(SWbemLocator.java:165)
at cn.chenlichao.wmi4j.SWbemLocator.connectServer(SWbemLocator.java:177)
at com.mycompany.javacombridge.JACOB.main(JACOB.java:60)