From 63a64f24b949bca5f2b1f4b7852ce45d9258bf40 Mon Sep 17 00:00:00 2001 From: Stefan Stankovic Date: Wed, 11 Aug 2021 09:59:06 +0200 Subject: [PATCH] Update .net version on for windows machine Added a new shell script for downloading .net 4.8 and updated a puppet script for installing the downloaded .net version. Partially resolved PROD-2718 --- files/windows_base/install_net48.ps1 | 16 ++++++++++++++++ manifests/windows_base.pp | 14 +++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 files/windows_base/install_net48.ps1 diff --git a/files/windows_base/install_net48.ps1 b/files/windows_base/install_net48.ps1 new file mode 100644 index 0000000..e5bff10 --- /dev/null +++ b/files/windows_base/install_net48.ps1 @@ -0,0 +1,16 @@ +$location = "c:\install" +Set-Location $location + +$client = new-object System.Net.WebClient + +if (!(Test-Path (Join-Path $location "ndp48-x86-x64-allos-enu.exe"))) +{ + "Downloading .net48" + $net4Url = "https://download.visualstudio.microsoft.com/download/pr/2d6bb6b2-226a-4baa-bdec-798822606ff1/8494001c276a4b96804cde7829c04d7f/ndp48-x86-x64-allos-enu.exe" + $client.DownloadFile( $net4Url, (Join-Path $location "ndp48-x86-x64-allos-enu.exe") ) + $net4Log = Join-Path $location "ndp48-x86-x64-allos-enu.log" + "Installing .net4" + Start-Process ndp48-x86-x64-allos-enu.exe ("/q /log " + $net4Log) -wait +} + +new-item C:\install\ndp48-x86-x64-allos-enu.txt -itemtype file \ No newline at end of file diff --git a/manifests/windows_base.pp b/manifests/windows_base.pp index d7c836a..80c3ed9 100644 --- a/manifests/windows_base.pp +++ b/manifests/windows_base.pp @@ -366,17 +366,17 @@ require => Exec['set-chocolatey-path'], } - if versioncmp($::kernelmajversion, '6.1') == 0 { - # Install .net40 - file { 'c:/install/install_net40.ps1': + if versioncmp($::kernelmajversion, '6.1') >= 0 { + # Install .net48 + file { 'c:/install/install_net48.ps1': ensure => 'file', - source => 'puppet:///modules/atomia/windows_base/install_net40.ps1', + source => 'puppet:///modules/atomia/windows_base/install_net48.ps1', } exec { 'Install-NET40': - command => 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy remotesigned -file C:\install\install_net40.ps1', - creates => 'C:\install\installed_net40.txt', - require => File['c:/install/install_net40.ps1'], + command => 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy remotesigned -file C:\install\install_net48.ps1', + creates => 'C:\install\installed_net48.txt', + require => File['c:/install/install_net48.ps1'], } }