Guest User

Untitled

a guest
Jun 7th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. use strict; use warnings;
  2.  
  3. use VMOMI;
  4. use Data::Dumper;
  5.  
  6. my $host = 'vcenter1.example.com',
  7. my $user = 'myuser';
  8. my $pass = 'STRONG';
  9.  
  10. my $stub = new VMOMI::SoapStub(host => $host) || die "Failed to initialize VMOMI::SoapStub";
  11.  
  12. my $instance = new VMOMI::ServiceInstance(
  13. $stub,
  14. new VMOMI::ManagedObjectReference(
  15. type => 'ServiceInstance',
  16. value => 'ServiceInstance',
  17. ),
  18. );
  19.  
  20. # Login
  21. my $content = $instance->RetrieveServiceContent;
  22. my $session = $content->sessionManager->Login(userName => $user, password => $pass);
  23.  
  24. my $vm = new VMOMI::VirtualMachineToolsRunningStatus(
  25. $stub,
  26. new VMOMI::VirtualMachineToolsRunningStatus(
  27. type => 'VirtualMachine',
  28. value => 'vm-name-foobar'
  29. )
  30. );
  31. use Data::Dumper;
  32. print Dumper $vm;
  33.  
  34. # Logout
  35. $content->sessionManager->Logout();
Add Comment
Please, Sign In to add comment