VMware Cloud Community
lElOUCHE_79
Enthusiast
Enthusiast
Jump to solution

Create SSO user if doesn't exist using "New-SsoPersonUser"

Hello

I'm trying to create a script in order to create a new SSO user (in vCenter) if does not exist.

based on the New Open Source PowerCLI Module for managing vCenter Single Sign-On (SSO) - VMware PowerCLI Blog

we can create a new user like this : 

New-SsoPersonUser -User lamw -Password 'MyStrongPa$$w0rd' -EmailAddress 'lamw@primp-industries.com' -FirstName 'William' -LastName 'Lam'

it's possible to achieve this via a loop that first check if user exist, if not, then we create it and enter details at console?

Reply
0 Kudos
1 Solution

Accepted Solutions
mpeneva
VMware Employee
VMware Employee
Jump to solution

Do you have the module loaded in the session you've invoked the corresponding 'Get-' command ?

View solution in original post

5 Replies
LucD
Leadership
Leadership
Jump to solution

Use the Get-SsoPersonUser cmdlet to check if the user already exists


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

lElOUCHE_79
Enthusiast
Enthusiast
Jump to solution

I used this 

$User = Get-SsoPersonUser -Name $userName -Domain vsphere.local
I get the error message 
 
The term 'Get-SsoPersonUser' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is
| correct and try again.
 
I guess I'm doing something wrong here
Reply
0 Kudos
mpeneva
VMware Employee
VMware Employee
Jump to solution

Do you have the module loaded in the session you've invoked the corresponding 'Get-' command ?

lElOUCHE_79
Enthusiast
Enthusiast
Jump to solution

Thanks I totally forget to import that module :slightly_smiling_face:

Reply
0 Kudos
mpeneva
VMware Employee
VMware Employee
Jump to solution

It's normal! It happens sometimes :winking_face: But it's great that you find the clue :slightly_smiling_face:

Reply
0 Kudos