28 lines
954 B
PowerShell
28 lines
954 B
PowerShell
function Get-SecurityGroupPrefix {
|
|
<#
|
|
.SYNOPSIS
|
|
Easily return human-readable name for the Security Group in which a host belongs.
|
|
.DESCRIPTION
|
|
Query the host's Machine.config to determine the Security Group for a host and return in a format people can use.
|
|
|
|
.PARAMETER ComputerName
|
|
Optional Parameter. If specified, gets the Security Group for that server's pod, lane, designation, etc. Defaults to local computer.
|
|
|
|
.EXAMPLE
|
|
|
|
Get-SecurityGroup -ComputerName APP169671
|
|
#>
|
|
[CmdletBinding()]
|
|
param (
|
|
[Parameter(Mandatory = $false)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[string]$ComputerName="$env:computerName"
|
|
)
|
|
|
|
# get the FQDN no matter what for simplicity
|
|
$ComputerName=[System.Net.Dns]::GetHostByName($ComputerName).HostName
|
|
|
|
$securityGroup=Get-AppSetting -Key Environment.UserPrefix -ComputerName $ComputerName
|
|
|
|
return $securityGroup
|
|
} |