VMware Cloud Community
Mallik7
Enthusiast
Enthusiast

I'm in need a of script

Hello,

I'm in need of a power cli script that helps to generate a 15 characters complex password (alphabets and numeric with special characters). Then script should be able to reset the current administrator (vsphere.local) password of the vCenter server (6.5 windows OS) and set a new pwd to the admin account. The newly generated password should be added to the .csv output as well.

could you help.

TIA

0 Kudos
3 Replies
LucD
Leadership
Leadership

If you use the VMware.vSphere.SsoAdmin module, you could do the following.

The GeneratePassword method allows specifying how many characters the password should have and how many non-alphanumeric characters it should contain.

#requires -Modules  VMware.vSphere.SsoAdmin

Connect-SsoAdminServer -Server vcsadomain -User 'administrator@vsphere.local' -Password 'VMware1!'


Add-Type -AssemblyName 'System.Web'

$newPswd = [System.Web.Security.Membership]::GeneratePassword(15,1)


Get-SsoPersonUser -Domain 'vsphere.local' -Name 'administrator' |

Set-SsoPersonUser -NewPassword $newPswd


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

0 Kudos
Mallik7
Enthusiast
Enthusiast

it is bit confusing to me. Is there any other way can accomplish this please...

0 Kudos
LucD
Leadership
Leadership

Not that I know of.
Until that module was released there was no way to interact with SSO via an API.

And what is confusing about the code?


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

0 Kudos