vsphere-automation-sdk-java icon indicating copy to clipboard operation
vsphere-automation-sdk-java copied to clipboard

Getting following error while connecting to Guest OS: Client received SOAP Fault from server: Permission to perform this operation was denied. Please see the server log to find more detail regarding exact cause of the failure

Open LakshmanPatil opened this issue 6 years ago • 1 comments

  • [x] I am using the latest SDK version
  • [ ] This API is compatible with my vCenter version (You can get this info from the API documentation )
  • [ ] I have searched existing issues

Description

Environment

  • SDK version: 6.7.0

  • Java version: 1.8

  • vSphere version: 6.7.0

Steps or code snippet to reproduce

String[] opts = new String[]{"guest.guestOperationsReady"}; String[] opt = new String[]{"guest.guestOperationsReady"}; wV.wait(ob, opts, opt,new Object[][]{{true}}); Map<String, ManagedObjectReference> var1 = VimUtil.inFolderByType(vimPort,serviceContent,serviceContent.getRootFolder(), "VirtualMachine"); ManagedObjectReference var2 = (ManagedObjectReference)var1.get(vmName); if (var2 != null) { System.out.println("Virtual Machine " + vmName + " found"); System.out.println("Guest Operations are ready for the VM"); ManagedObjectReference guestOpManger = serviceContent.getGuestOperationsManager(); ManagedObjectReference fileManagerRef = (ManagedObjectReference) VimUtil.entityProps(vimPort,serviceContent,guestOpManger, new String[]{"fileManager"}).get("fileManager"); System.out.println(fileManagerRef); System.out.println(fileManagerRef.getType()); System.out.println(fileManagerRef.getValue()); NamePasswordAuthentication auth = new NamePasswordAuthentication(); auth.setUsername("username"); auth.setPassword("password"); auth.setInteractiveSession(false); vimPort.validateCredentialsInGuest(fileManagerRef, var2, auth); System.out.println("validation for guest Credentials"); List<String> li=new ArrayList<>(); li.add("open notepad.exe"); System.out.println("Executing CreateTemporaryFile guest operation"); System.out.println("FileInitailization"+vimPort.initiateFileTransferFromGuest(fileManagerRef, var2, auth, "C:\Users\")); vimPort.createFolder(fileManagerRef, "C:\Users\Public\dsfsfs"); String result = vimPort.createTemporaryFileInGuest(fileManagerRef, var2, auth,"TestAfter", "BeforeTest", "C:\Users\Public"); System.out.println("Temporary file was successfully created at: " + result + " inside the guest");

Actual behavior

Unable to login to Guest OS and not fetching any files

Expected behavior

Login to Guest OS should happen, file directory inside Guest os should be available to perform read and write operation.

Note: I am not sure that the methods i am trying is the correct one. Please help me with correct one. Even I am not able to fetch the ip address of the VM using sdk.

LakshmanPatil avatar Aug 22 '19 10:08 LakshmanPatil

@kunal-pmj Could you please me help on this issue???

LakshmanPatil avatar Aug 27 '19 09:08 LakshmanPatil