Fix Get-VMCOrg / Get-VMCSDDC to use -eq vs -match

This commit is contained in:
William Lam
2019-06-19 06:01:10 -07:00
parent 5f3f41ff44
commit e7222d13f7

View File

@@ -81,13 +81,13 @@ Function Get-VMCOrg {
Return all the info about the orgs you are a part of Return all the info about the orgs you are a part of
#> #>
Param ( Param (
[Parameter(Mandatory=$false)]$Name [Parameter(Mandatory=$false)]$Name
) )
If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use Connect-VMC to connect" } Else { If (-Not $global:DefaultVMCServers) { Write-error "No VMC Connection found, please use Connect-VMC to connect" } Else {
$orgService = Get-VMCService com.vmware.vmc.orgs $orgService = Get-VMCService com.vmware.vmc.orgs
if ($PSBoundParameters.ContainsKey("Name")){ if ($PSBoundParameters.ContainsKey("Name")){
$orgs = $orgService.list() | Where {$_.display_name -match $Name} $orgs = $orgService.list() | Where {$_.display_name -eq $Name}
} Else { } Else {
$orgs = $orgService.list() $orgs = $orgService.list()
} }
@@ -130,7 +130,7 @@ Function Get-VMCSDDC {
$orgID = $org.ID $orgID = $org.ID
$sddcService = Get-VMCService com.vmware.vmc.orgs.sddcs $sddcService = Get-VMCService com.vmware.vmc.orgs.sddcs
if ($PSBoundParameters.ContainsKey("Name")){ if ($PSBoundParameters.ContainsKey("Name")){
$sddcService.list($OrgID) | Where {$_.name -match $Name} $sddcService.list($OrgID) | Where {$_.name -eq $Name}
} Else { } Else {
$sddcService.list($OrgID) $sddcService.list($OrgID)
} }