VMware Cloud Community
Shashikant_Gupt
Contributor
Contributor

How to add new local user to vCenter Server Appliance 6.x

Hi all,

I want to add a new user for the vCenter Server VM , not found any option to create a local user from vCenter.

Here the case is I can add a user on ESXi host but unable to create on vCenter server for locals domain.

Problem is I want to create a user which can access the VM (vCenter Server) using putty or winscp, also this user should have rights to login on web client.

I am able to create a user from putty, after login to putty with root user and run some commands like :-

>> useradd username

>> passwd username

and I can find this user in vSphere Client under permission tab and assign required permission and role.

I am unable to create the user from vSphere client or web client, via web client there is one option to create a user for vsphere.local domain but no option to add a user for locals domain.

one more thing I want to create this user from Power CLI, for vCenter Server VM not for ESXi host machine.

I can assign permission to already created user from Power CLI command but unable to create a new user.

Thanks

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

Since the VCSA comes with the VMware Tools installed, you should be able to use the Invoke-VMScript cmdlet to launch the creation of additional accounts.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Shashikant_Gupt
Contributor
Contributor

Thanks a lot LucD,

Your answer is really works, I can run the useradd commands using the Invoke-VMScript cmdlet.   this cmdlet is in Module:  VMware.VimAutomation.Core

Could you please help me to run this cmdlet from my c#.net code, as I am new to Power CLI.

how can I found a equivalent DLL of  VMware.VimAutomation.Core module , and what will be a method equivalent to Invoke-VMScript cmdlet.

Thanks.

Reply
0 Kudos
LucD
Leadership
Leadership

You can find the DLL behind a cmdlet like this

Get-Command -Name Invoke-VMScript | Select -ExpandProperty DLL

The underlying API is the StartProgramInGuest, in the GuestProcessManager managed object.

In PowerShell I get to these methods like this

$si = Get-View ServiceInstance -Server $global:DefaultVIServer

$guestMgr = Get-View -Id $si.Content.GuestOperationsManager -Server $global:DefaultVIServer

$gProcessMgr = Get-View -Id $guestMgr.ProcessManager -Server $global:DefaultVIServer


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos