function Get-PodName { <# .SYNOPSIS Easily return human-readable name for the pod, lane, designation in which a host belongs. .DESCRIPTION Query the host's Machine.config to determine the pod, lane, designation, etc, and return in a format people can use. .PARAMETER ComputerName Optional Parameter. If specified, gets the name for that server's pod, lane, designation, etc. .PARAMETER Full Optional Parameter. If specified, returns the full name of the environment. Otherwise, returns the short name. .EXAMPLE Get-PodName -ComputerName APP169671 #> [CmdletBinding()] param ( [Parameter(Mandatory = $false)] [ValidateNotNullOrEmpty()] [string]$ComputerName = "$env:computerName", [Parameter(Mandatory = $false)] [switch]$Full ) # get the FQDN no matter what for simplicity $ComputerName=[System.Net.Dns]::GetHostByName($ComputerName).HostName # get the key value $keyValue = Get-AppSetting -Key Environment.Name -ComputerName $ComputerName if ( $Full ) { $keyValue } else { $podName = ($keyValue -split " ")[-1] $podName } }