fix: aws starter template compatability

This commit is contained in:
Ben Potter
2024-06-26 16:34:52 -05:00
committed by GitHub
parent de00f6334f
commit 9864408643

View File

@@ -60,9 +60,12 @@ resource "coder_script" "windows-rdp" {
$moduleName = "DevolutionsGateway"
$moduleVersion = "2024.1.5"
# Install the module with the specified version for all users
# This requires administrator privileges
Install-Module -Name $moduleName -RequiredVersion $moduleVersion -Force
try {
# Try to import the module directly
Import-Module $moduleName -ErrorAction Stop
} catch {
# If it fails, install and then import the module
Install-Module -Name $moduleName -RequiredVersion $moduleVersion -Force -Confirm:$false -SkipPublisherCheck
# Construct the module path for system-wide installation
$moduleBasePath = "C:\Windows\system32\config\systemprofile\Documents\PowerShell\Modules\$moduleName\$moduleVersion"
@@ -70,6 +73,8 @@ resource "coder_script" "windows-rdp" {
# Import the module using the full path
Import-Module $modulePath
}
Install-DGatewayPackage
# Configure Devolutions Gateway