ps/Modules/Alkami.PowerShell.Common/Public/Get-AwsSettings.ps1
2023-05-30 22:51:22 -07:00

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
}