From f3696971124c86ecc92d9b73dce57db164e509c8 Mon Sep 17 00:00:00 2001 From: Parkreiner Date: Fri, 28 Jun 2024 17:21:24 +0000 Subject: [PATCH] wip: add try/catch block --- windows-rdp/main.tf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/windows-rdp/main.tf b/windows-rdp/main.tf index ffa2256..09622a7 100644 --- a/windows-rdp/main.tf +++ b/windows-rdp/main.tf @@ -62,6 +62,12 @@ resource "coder_script" "windows-rdp" { # Install the module with the specified version for all users # This requires administrator privileges + try { + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force + Install-Module -Name $moduleName -RequiredVersion $moduleVersion -Force + } catch { + Install-Module -Name $moduleName -RequiredVersion $moduleVersion -Force + } Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name $moduleName -RequiredVersion $moduleVersion -Force