doskiran's Posts

Use ganymed-ssh2-build210.jar SSH java api's to run those commands remotly.
Yes HostLocalAccountManager works only for ESXi, it will throw null for VC session (si.getAccountManager()) Use SSH commands to create users and groups on linux or windows VC, Commands for Linu... See more...
Yes HostLocalAccountManager works only for ESXi, it will throw null for VC session (si.getAccountManager()) Use SSH commands to create users and groups on linux or windows VC, Commands for Linux VC: // Add new group > pi shell groupadd groupname // Add new user pi shell useradd -g " + group + " " + user + " -p `openssl passwd -crypt " + TestConstants.PASSWORD + "`" > pi shell useradd -g  group  user  -p `openssl passwd -crypt password` Commands for Windows VC: // Add new user > net user username password  /ADD /EXPIRES:NEVER // Add new group > net localgroup group /ADD  // Assign the user to the group > net localgroup group  user  /ADD 
Use the java sample - Assign dvSwitch portgroup to the existing VM network adapter https://code.vmware.com/samples/1824  
Here is the Java API to "Adds the VMkernel network adapter for all the hosts in the dvSwitch and assign them to dvPortgroup ports and also enable vMotion service in vmkernel " Add VMkernel nic... See more...
Here is the Java API to "Adds the VMkernel network adapter for all the hosts in the dvSwitch and assign them to dvPortgroup ports and also enable vMotion service in vmkernel " Add VMkernel nic in all hosts in the dvSwitch and enable vMotion. - Samples - VMware {code}
I tried the same operation it works for me using build "5638405"(6.5.0). Same steps like: 1) Copied and unziped the VMware-vSphere-SDK-6.5.0-5638405.zip in C: drive 2) Open command prompt and ... See more...
I tried the same operation it works for me using build "5638405"(6.5.0). Same steps like: 1) Copied and unziped the VMware-vSphere-SDK-6.5.0-5638405.zip in C: drive 2) Open command prompt and set JAVAHOME ("set JAVAHOME="C:\Program Files\Java\jdk1.8.0_131") 3) Run the command, > C:\VMware-vSphere-SDK-6.5.0-5638405\SDK\ssoclient\java\JAXWS> run.bat com.vmware.sso.client.samples.AcquireBearerTokenByUserCredentialSample https://10.10.xx.xx/sts/STSService Administrator@vsphere.local  password Output:: Aquiring a bearer token by using user credentials Token details:         AssertionId = _6ba49c4d-0fc6-4721-9ee7-79beb6062339         Token type = Bearer         Issued On = 2017-07-03T09:01:32.113Z Done. I am thinking it may failed because of some TLS connection, its better to add " -Dhttps.protocols="TLSv1,TLSv1.1,TLSv1.2" "  at the end of the command and try. i.e, > C:\VMware-vSphere-SDK-6.5.0-5638405\SDK\ssoclient\java\JAXWS> run.bat com.vmware.sso.client.samples.AcquireBearerTokenByUserCredentialSample https://10.10.xx.xx/sts/STSService Administrator@vsphere.local  password -Dhttps.protocols="TLSv1,TLSv1.1,TLSv1.2"
I didn't see any issue in the above code, try the below steps which i follow and worked for me. Add all  vmfsUuid into MethodActionArgument[] array and convert the array into vector and then add... See more...
I didn't see any issue in the above code, try the below steps which i follow and worked for me. Add all  vmfsUuid into MethodActionArgument[] array and convert the array into vector and then add to the MethodAction arguments list. MethodAction methodAction = new MethodAction(); MethodActionArgument[] arguments = new MethodActionArgument[3]; for (int i = 0; i < arguments.length; i++) {             MethodActionArgument argument = new MethodActionArgument();             argument.setValue(vmfsUuid[i]);             arguments[i] = argument; } methodAction .getArgument().clear(); //conver "arguments" to vector and add to "methodAction " arguments. methodAction .getArgument().addAll(arrayToVector(arguments))
Steps: 1) Connects to the remote host using SSH      Connection connection = new Connection(esxiHost);          connection .connect(); 2) Execute the command on the remote host using SSH    ... See more...
Steps: 1) Connects to the remote host using SSH      Connection connection = new Connection(esxiHost);          connection .connect(); 2) Execute the command on the remote host using SSH    Session sessionStr = connection .openSession();    sessionStr .execCommand(command);
Its better to SSH to ESXi host and execute the above esxcli commands remotely using java apis(ganymed-ssh2-build210.jar)
Below is the sample code to use the logUserEvent api., lets check in the respective VM -> Events tab , it will show the event message.     public static void logUserEventonVM(ServiceInstance si... See more...
Below is the sample code to use the logUserEvent api., lets check in the respective VM -> Events tab , it will show the event message.     public static void logUserEventonVM(ServiceInstance si,             ManagedEntity vmManagedEntity) {         EventManager eventMgr = si.getEventManager();         String eventMsg = "VM LogUserEvent";         try {             eventMgr.logUserEvent(vmManagedEntity, eventMsg);         } catch (Exception e) {             e.printStackTrace();         }   }   public static void logUserEventonVM(ServiceInstance si, ManagedEntity vmManagedEntity) { EventManager eventMgr = si.getEventManager(); String eventMsg = "VM LogUserEvent"; try { eventMgr.logUserEvent(vmManagedEntity, eventMsg); } catch (Exception e) {   e.printStackTrace(); } }     public static void logUserEventonVM(ServiceInstance si,             ManagedEntity vmManagedEntity) {         EventManager eventMgr = si.getEventManager();         String eventMsg = "VM LogUserEvent";         try {             eventMgr.logUserEvent(vmManagedEntity, eventMsg);         } catch (Exception e) {             e.printStackTrace();         }     }     public static void logUserEventonVM(ServiceInstance si,             ManagedEntity vmManagedEntity) {         EventManager eventMgr = si.getEventManager();         String eventMsg = "VM LogUserEvent";         try {             eventMgr.logUserEvent(vmManagedEntity, eventMsg);         } catch (Exception e) {             e.printStackTrace();         }     }
Using the GuestNicInfo class from VM GuestInfo class to retrive the all VM ip addresses. Below is the code sample. public static void getVMIPAddresses(VirtualMachine vm) {         GuestInfo gue... See more...
Using the GuestNicInfo class from VM GuestInfo class to retrive the all VM ip addresses. Below is the code sample. public static void getVMIPAddresses(VirtualMachine vm) {         GuestInfo guest = vm.getGuest();         if (null != guest) {             GuestNicInfo getNet[] = guest.getNet();             if (null != getNet) {                 for (int i = 0; i < getNet.length; i++) {                     if (getNet[i].getIpAddress() != null) {                         for (String ip : getNet[i].getIpAddress()) {                             System.out.println("Ipaddress " + ip);                         }                     }                 }             }         }     }
Yes by using same datcenter network folder(nws) api to get the dvSwitches under datacenter. ManagedEntity[] childEntity = nws .getChildEntity(); for (ManagedEntity me : childEntity) {      ... See more...
Yes by using same datcenter network folder(nws) api to get the dvSwitches under datacenter. ManagedEntity[] childEntity = nws .getChildEntity(); for (ManagedEntity me : childEntity) {          if (me instanceof com.vmware.vim25.mo.DistributedVirtualSwitch) {                    System.out.println(me.getName());         } }
Here is the sample code to get all linked vCenters by using userAgent , here userAgent is the name of user agent or application. In my case I opened my linked VC atleast onetime with web-client,... See more...
Here is the sample code to get all linked vCenters by using userAgent , here userAgent is the name of user agent or application. In my case I opened my linked VC atleast onetime with web-client, so userAgent comparing with "web-client" in the code. Eg:: userAgents  starts with - "web-client" , "Java" , "cl" ,"VMware vim-java" ..... public List<String> getAllLinkedVCServers(String vcenterIP, String userName,String password) { List<String> vcList = new ArrayList<String>();    try {           ServiceInstance si = new ServiceInstance(new URL("https://"+ vcenterIP + "/sdk"), userName, password, true);           UserSession[] userSessions = si.getSessionManager();           for (int i = 0; i < userSessions.length; i++) {                       if (userSessions[i].getUserAgent().contains("web-client")) {                              vcList.add(userSessions[i].getIpAddress());                      } }         } catch (Exception e) {               e.printStackTrace();  }     return vcList; }
Here is few java code samples to customize VM HardDisk(add or extend), Network adapters(add) and assigning specific nics to VSS/DVS portgroups. 1) Add new harddisk with specified capacity and ... See more...
Here is few java code samples to customize VM HardDisk(add or extend), Network adapters(add) and assigning specific nics to VSS/DVS portgroups. 1) Add new harddisk with specified capacity and disk provisioning type for a VM Add new harddisk with specified capacity and disk provisioning type for a VM - Samples 2) Extend the existing VM harddisk with specified capacity Extend VM Hard Disk - Samples 3) Add new network adapter and assign the nic to specified standard switch portgroup Add and Reconfig VM Nic To VSS - Samples 4) Add new network adapter and assign the nic to specified distributed switch portgroup Add a new network adapter and assign the nic to specified distributed switch portgroup - Samples 5) Assign particular dvSwitch portgroup to the specified network adapter Assign dvSwitch portgroup to the specified VM network adapter - Samples Thanks, Kiran
Still it is not working, giving same message.but in vmware-vmrc logs showing some certificate issue.... CertificateCheck::CheckCertEmbedded: allowSSLErrors: false 2013-05-07T17:11:42.984+05:3... See more...
Still it is not working, giving same message.but in vmware-vmrc logs showing some certificate issue.... CertificateCheck::CheckCertEmbedded: allowSSLErrors: false 2013-05-07T17:11:42.984+05:30| vmrc| I120: CertificateCheck::CheckCertEmbedded: Found the following errors for 172.22.17.132's SSL certificate: { 2013-05-07T17:11:42.984+05:30| vmrc| I120:   - 2147483650 2013-05-07T17:11:42.984+05:30| vmrc| I120:   - The host certificate chain is not complete. 2013-05-07T17:11:42.984+05:30| vmrc| I120:   - The host name used for the connection does not match the subject name on the host certificate. 2013-05-07T17:11:42.984+05:30| vmrc| I120: } 2013-05-07T17:11:42.985+05:30| vmrc| I120: cui::vmrc::VMCnx::OnConnectAborted: Connect cancelled for MOID "134" on "172.22.17.132" 2013-05-07T17:11:42.985+05:30| vmrc| I120: cui::vmrc::VMCnxMgr::EmitConnectionStateSignal: Emitting "disconnected" signal (requested) for MOID "134" on "172.22.17.132" - reason 'An error occurred that affected the security of the connection' I hope for your help. Thanks.
Hi, Thanks for your solution.For IE it is working fine. But for firefox with my vmrc plugin mimetype:"application/x-vmware-vmrc;version=2.5.0.199067" it is not working. And also i am see one m... See more...
Hi, Thanks for your solution.For IE it is working fine. But for firefox with my vmrc plugin mimetype:"application/x-vmware-vmrc;version=2.5.0.199067" it is not working. And also i am see one more difference is, with same vmrc plugin is showing different mimetype version in IE & FF. for IE it is showing mimetype::"application/x-vmware-vmrc;version=2.5.0.199067" and for FF mimetype:"application/x-vmware-remote-console-2011;version=4.0.0.10045". I tried with both minetype it is not working and also tried with your mimetype.Can you please suggest me where exactly the problem or VMRC plugin support FF or not.