39 lines
1011 B
PowerShell
39 lines
1011 B
PowerShell
|
function Test-IsOverflowServer {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Returns a boolean indicating if the current machine is an overflow or not.
|
||
|
|
||
|
.DESCRIPTION
|
||
|
This will check the EC2 tags for a server and look for the key value of alk:overflow.
|
||
|
Will return true if alk:overflow:true is found and false in any other scenario.
|
||
|
|
||
|
.EXAMPLE
|
||
|
# Testing on a standard server
|
||
|
Test-IsOverflowServer
|
||
|
False
|
||
|
|
||
|
.EXAMPLE
|
||
|
# Testing on an overflow server
|
||
|
Test-IsOverflowServer
|
||
|
True
|
||
|
#>
|
||
|
|
||
|
[CmdletBinding()]
|
||
|
[OutputType([bool])]
|
||
|
param (
|
||
|
)
|
||
|
|
||
|
$logLead = (Get-LogLeadName)
|
||
|
|
||
|
try {
|
||
|
$isOverflowServer = Get-CurrentInstanceTags -tagName "alk:overflow" -ValueOnly
|
||
|
|
||
|
if ($isOverflowServer -eq 'true') {
|
||
|
return $true
|
||
|
} else {
|
||
|
return $false
|
||
|
}
|
||
|
} catch {
|
||
|
Write-Warning "$logLead`: Unable to query tags. This needs to be run on an AWS Server or the environment is set up incorrectly."
|
||
|
}
|
||
|
}
|