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.
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.
Connect-SsoAdminServer -Server vcsadomain -User 'email@example.com' -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