From aa8d5e3c261625cdd4bf536088671d7074177cd2 Mon Sep 17 00:00:00 2001 From: William Lam Date: Fri, 28 Feb 2020 08:51:45 -0800 Subject: [PATCH] List VCSA Identity Source --- .../VCSAIdentitySource.psm1 | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Modules/VCSAIdentitySource/VCSAIdentitySource.psm1 diff --git a/Modules/VCSAIdentitySource/VCSAIdentitySource.psm1 b/Modules/VCSAIdentitySource/VCSAIdentitySource.psm1 new file mode 100644 index 0000000..596cab1 --- /dev/null +++ b/Modules/VCSAIdentitySource/VCSAIdentitySource.psm1 @@ -0,0 +1,28 @@ +Function Get-VCSAIdentitySource { +<# + .DESCRIPTION Retrieves vCenter Server Appliance Identity Source Configuration + .NOTES Author: William Lam + .PARAMETER VCSAName + Inventory name of the VCSA VM + .PARAMETER VCSARootPassword + Root password for VCSA VM + .EXAMPLE + Get-VCSAIdentitySource -VCSAName "MGMT-VCSA-01" -VCSARootPassword "VMware1!" +#> + Param ( + [Parameter(Mandatory=$true)][String]$VCSAName, + [Parameter(Mandatory=$true)][String]$VCSARootPassword + ) + + $vm = Get-Vm -Name $VCSAName + + if($vm) { + $identitySources = Invoke-VMScript -ScriptText "/opt/vmware/bin/sso-config.sh -get_identity_sources 2> /dev/null | sed -ne '/^*/,$ p'" -vm $vm -GuestUser "root" -GuestPassword $VCSARootPassword + + Write-Host -ForegroundColor green "`nIdentity Sources: " + $identitySources + + } else { + Write-Host "`nUnable to find VCSA named $VCSAName" + } +} \ No newline at end of file