36 lines
871 B
PowerShell
36 lines
871 B
PowerShell
|
function Get-AwsSettings {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Get AWS settings (region) from a specific server. Assumes the server is accessible.
|
||
|
.PARAMETER ServerToTest
|
||
|
Server to remote into to get AWS details from.
|
||
|
.PARAMETER ProfileName
|
||
|
AWS Profile to use.
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
param(
|
||
|
$ServerToTest,
|
||
|
$ProfileName
|
||
|
)
|
||
|
$logLead = (Get-LogLeadName);
|
||
|
$scriptBlock = {
|
||
|
|
||
|
$currentRegion = Get-CurrentInstanceRegion
|
||
|
|
||
|
$returnSettings = @{
|
||
|
"Region" = $currentRegion
|
||
|
}
|
||
|
|
||
|
return $returnSettings
|
||
|
}
|
||
|
|
||
|
Write-Host "$logLead : Attempting to Get Aws Settings from $ServerToTest."
|
||
|
$serverInfo = Invoke-Command -ScriptBlock $scriptBlock -ComputerName $ServerToTest
|
||
|
|
||
|
$settings = @{
|
||
|
"Region" = $serverInfo.Region
|
||
|
"Profile" = $ProfileName
|
||
|
}
|
||
|
|
||
|
return $settings
|
||
|
}
|