using 'AWSPowerShell' version 4.1.281:
PS C:\Users\UserMe> (Get-Command Set-DefaultAWSRegion).ImplementingType.Assembly
GAC Version Location
--- ------- --------
False v4.0.30319 C:\Program Files\WindowsPowerShell\Modules\AWSPowerShell\4.1.281\AWSPowerShell.dll
On a virtual windows server 2012 r2, configured with 8 cores of CPU and 16 GB of RAM, with PowerShell v5.1 and .NET v4.7 installed. I'm experiencing a very slow loading time, of the PowerShell module above:
Measure-Command {
Import-Module -Name AWSPowerShell
}
Days : 0
Hours : 0
Minutes : 1
Seconds : 24
Milliseconds : 977
Ticks : 849770741
TotalDays : 0.000983530950231481
TotalHours : 0.0236047428055556
TotalMinutes : 1.41628456833333
TotalSeconds : 84.9770741
TotalMilliseconds : 84977.0741
Trying to load the module to the Global scope, to be use by other PowerShell scripts:
Measure-Command {
Import-Module -Name AWSPowerShell -Scope Global
#Import-Module -Name AWSPowerShell -Global
}
Or load specific cmdlets:
Measure-Command {
Import-Module -Name AWSPowerShell -Cmdlet Set-DefaultAWSRegion
}
Didn't change the loading time either.
Which results in a constant crashing of all my AWS scripts, that runs every minute, and relays on that module, to perform different actions against AWS.
Is there any way in PowerShell to optimize the loading time of the module? for example, to edit the manifest file (AWSPowerShell.psd1), to load specific assemblies with the require cmdlets, in the module?