vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
743 stars 602 forks source link

Implement Set Default Identity Source and Get Default Identity Source #545

Closed dmilov closed 2 years ago

dmilov commented 2 years ago

Fix for issue #540

Added -Default switch parameter to Add-LDAPIdentitySource Set-LDAPIdentitySource Get-IdentitySource

Introduce a new cmdlet Set-IdentitySource with Default switch parameter that allows setting any identity source as default

Testing done:

PS C:\Users\dmilov> Get-IdentitySource

Name
----
localos
vsphere.local
sof-powercli-qe.eng.vmware.com

PS C:\Users\dmilov> Get-IdentitySource -Default

Type                   : ActiveDirectory
Alias                  :
AuthenticationType     : PASSWORD
AuthenticationUsername : administrator@sof-powercli-qe
FriendlyName           : sof-powercli-qe
PrimaryUrl             : ldap://sof-powercli-qe.eng.vmware.com:389
FailoverUrl            :
UserBaseDN             : CN=Users,DC=sof-powercli-qe,DC=eng,DC=vmware,DC=com
GroupBaseDN            : CN=Users,DC=sof-powercli-qe,DC=eng,DC=vmware,DC=com
Certificates           :
Name                   : sof-powercli-qe.eng.vmware.com

PS C:\Users\dmilov> Get-IdentitySource -Localos | Set-IdentitySource -Default
PS C:\Users\dmilov> Get-IdentitySource -Default

Name
----
localos

PS C:\Users\dmilov> Get-IdentitySource -External | Set-IdentitySource -Default
PS C:\Users\dmilov> Get-IdentitySource -Default

Type                   : ActiveDirectory
Alias                  :
AuthenticationType     : PASSWORD
AuthenticationUsername : administrator@sof-powercli-qe
FriendlyName           : sof-powercli-qe
PrimaryUrl             : ldap://sof-powercli-qe.eng.vmware.com:389
FailoverUrl            :
UserBaseDN             : CN=Users,DC=sof-powercli-qe,DC=eng,DC=vmware,DC=com
GroupBaseDN            : CN=Users,DC=sof-powercli-qe,DC=eng,DC=vmware,DC=com
Certificates           :
Name                   : sof-powercli-qe.eng.vmware.com

Signed-off-by: Dimitar Milov dmilov@vmware.com