function Get-ServersByPod { param ( [Parameter(Mandatory = $false)] [Alias('Environment')] [ValidateScript({Assert-ValidAWSProfileName -ProfileName $_ -ArgumentValidationScript})] $ProfileName = (Get-LocalCachedAWSProfile), [Parameter(Mandatory = $true)] [ArgumentCompleter( { param ( $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters ) $p = $fakeBoundParameters.ProfileName if ([string]::IsNullOrWhiteSpace($p)) { $p = (Get-LocalCachedAWSProfile) } $s = Get-CachedInstances -ProfileName $p return $s.Designation | Sort-Object | Get-Unique } )] [string]$Designation ) return (Get-CachedInstances -ProfileName $ProfileName).Where({$_.Designation -eq $Designation}) }