Permalink
Browse files

add missing check for windows 2016

  • Loading branch information...
RichieBzzzt committed May 1, 2018
1 parent 2632a55 commit 0e72d636a4bd4b18fd51c6c3eb531e26b8d8c207
Showing with 49 additions and 39 deletions.
  1. +49 −39 PoshSSDTBuildDeploy/Functions/TestNetInstalled.ps1
@@ -1,45 +1,55 @@
#ther should be some comments here!
Function Test-NetInstalled {
param(
[Parameter(Position = 1, mandatory = $false)]
[String] $DotNetVersion
)
[Int] $RegEditDotNet | Out-Null
[bool] $RequiredVersion = $true
$dWord = Get-ChildItem "hklm:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release
if ($DotNetVersion) {
switch ($DotNetVersion) {
"4.5" { $RegEditDotNet = 378389}
"4.5.1" { $RegEditDotNet = 378675}
"4.5.2" { $RegEditDotNet = 379893}
"4.6" { $RegEditDotNet = 393295}
"4.6.1" { $RegEditDotNet = 394254}
"4.6.2" { $RegEditDotNet = 394802}
"4.7" { $RegEditDotNet = 460798}
"4.7.1" { $RegEditDotNet = 461308}
default {$RegEditDotNet = 0}
}
if ($dWord -lt $RegEditDotNet -or $RegEditDotNet -eq 0 ) {
Write-Error "You must have .NET $DotNetVersion installed on this machine to continue!"
$RequiredVersion = $false
}
else {
Write-Host "At least $DotNetVersion is installed!" -ForegroundColor White -BackgroundColor Red
param(
[Parameter(Position = 1, mandatory = $false)]
[String] $DotNetVersion
)
[Int] $RegEditDotNet | Out-Null
[bool] $RequiredVersion = $true
$OSVersion = (get-itemproperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName).ProductName
$dWord = Get-ChildItem "hklm:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release
if ($DotNetVersion) {
switch ($DotNetVersion) {
"4.5" { $RegEditDotNet = 378389}
"4.5.1" { $RegEditDotNet = 378675}
"4.5.2" { $RegEditDotNet = 379893}
"4.6" { $RegEditDotNet = 393295}
"4.6.1" { $RegEditDotNet = 394254}
"4.6.2" { $RegEditDotNet = 394802}
"4.7" { $RegEditDotNet = 460798}
"4.7.1" {
if ($OSVersion -like "%2016%") {
$RegEditDotNet = 461310
}
else {
$RegEditDotNet = 461308
}
}
default {$RegEditDotNet = 0}
}
switch ($dWord) {
378389 { $DotNetVersion = "4.5" }
378675 { $DotNetVersion = "4.5.1"}
379893 { $DotNetVersion = "4.5.2" }
393295 { $DotNetVersion = "4.6" }
394254 { $DotNetVersion = "4.6.1" }
394802 { $DotNetVersion = "4.6.2" }
460798 { $DotNetVersion = "4.7" }
461308 { $DotNetVersion = "4.7.1" }
if ($dWord -lt $RegEditDotNet -or $RegEditDotNet -eq 0 ) {
Write-Error "You must have .NET $DotNetVersion installed on this machine to continue!"
$RequiredVersion = $false
}
else {
Write-Host "At least $DotNetVersion is installed!" -ForegroundColor White -BackgroundColor Red
}
$DotNetInfo = @{ DotNetVersion = $DotNetVersion; DWORD = $dWord[0]; RequiredVersion = $RequiredVersion}
return $DotNetInfo
}
}
switch ($dWord) {
378389 { $DotNetVersion = "4.5" }
378675 { $DotNetVersion = "4.5.1"}
379893 { $DotNetVersion = "4.5.2" }
393295 { $DotNetVersion = "4.6" }
394254 { $DotNetVersion = "4.6.1" }
394802 { $DotNetVersion = "4.6.2" }
460798 { $DotNetVersion = "4.7" }
461308 { $DotNetVersion = "4.7.1" }
461310 { $DotNetVersion = "4.7.1" }
}
$DotNetInfo = @{ DotNetVersion = $DotNetVersion; DWORD = $dWord[0]; RequiredVersion = $RequiredVersion}
return $DotNetInfo
}

0 comments on commit 0e72d63

Please sign in to comment.