Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 197835

Re: Query Local Users and Creating Local Users

$
0
0

To list Users, you will need to use the userDirectory managed object instead http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.UserDirectory.html and use the RetrieveUserGroups

 

Attached is a quick sample called listUsers.pl

 

vi-admin@vMA51:~> ./listUsers.pl --server vesxi51-1 --username root
Enter password:
Name: Administrator
Group: 0
Principal: root

 

Name: DCUI User
Group: 0
Principal: dcui

 

Name: VMware VirtualCenter administration account
Group: 0
Principal: vpxuser

 

Name: ESXi User
Group: 0
Principal: vslauser

 

Name: william
Group: 0
Principal: william

 

For your CreateUser() method, you're not passing in the expect property type as noted in the vSphere API Reference http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.host.LocalAccountManager.AccountSpecification.html whcih is a HostAccountSpec

 

It should be:

 

my $userSpec = HostAccountSpec->new(id => 'Inventory2', password => "aBc!56hh", description => "Inventory2");

$accountManager->CreateUser(user  => $userSpec);

The vSphere API reference is your friend

 

Good Luck


Viewing all articles
Browse latest Browse all 197835

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>