24 lines
736 B
PowerShell
24 lines
736 B
PowerShell
function Import-AWSModule {
|
|
<#
|
|
.SYNOPSIS
|
|
Load the AWS module in a common way, only load it if it hasn't been loaded yet
|
|
#>
|
|
[CmdletBinding()]
|
|
param (
|
|
|
|
)
|
|
|
|
if ($null -eq (Get-Module AWSPowershell)) {
|
|
try {
|
|
(Import-Module AWSPowershell -Scope Global) | Out-Null
|
|
} catch {
|
|
$modulePath = "C:\Program Files (x86)\AWS Tools\PowerShell\awspowershell"
|
|
if (!(Test-Path $modulePath)) {
|
|
Write-Error "Could not find the path for the AWSPowershell module, expected to find it at [$modulePath]"
|
|
} else {
|
|
Write-Error "Could not import AWSPowershell module"
|
|
Write-Error $_.Exception.Message
|
|
}
|
|
}
|
|
}
|
|
} |