Repository navigation
Expand file tree
/
Copy pathCheckDotNet.ps1
More file actions
58 lines (48 loc) · 2.01 KB
/
Copy pathCheckDotNet.ps1
File metadata and controls
58 lines (48 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<#
.Synopsis
fuctions to check if 2.0 and 3.5 version of .NET framework is present
.DESCRIPTION
Fuctions to check if 2.0 and 3.5 version of .NET framework is present
Author : vimalsh@live.com
#>
. .\FileLogging.ps1
Function IsDotNet35orGreater {
# Check if .NET version 3.5 or greater is present
[bool] $bVersionPresent = $false
$Frameworks = Get-ChildItem "HKLM:\Software\Microsoft\NET Framework Setup\NDP"
foreach($FWver in $Frameworks) {
# if it matches v[0-9].+ and is >= v3.5 then requisite is met
if(($FWver.PSChildName -match "v[0-9].+") -and ($FWver.PSChildName -ge "v3.5"))
{
Write-LogFileEntry "IsDotNet35orGreater: $($FWver.PSChildName) is present " | Out-Null
$bVersionPresent = $true
break
}
else
{
Write-LogFileEntry "IsDotNet35orGreater: $($FWver.PSChildName) is not .NET 3.5. Checking next higher version." | Out-Null
}
}
Write-LogFileEntry "IsDotNet35orGreater: .NET 3.5 Pre-requisite checker returned $bVersionPresent." | Out-Null
return $bVersionPresent
}
Function IsDotNet2orGreater {
# Check if .NET version 2.0 or greater is present
[bool] $bVersionPresent = $false
$Frameworks = Get-ChildItem "HKLM:\Software\Microsoft\NET Framework Setup\NDP"
foreach($FWver in $Frameworks) {
# if it matches v[0-9].+ and is >= v2.0 then requisite is met
if(($FWver.PSChildName -match "v[0-9].+") -and ($FWver.PSChildName -ge "v2.0"))
{
Write-LogFileEntry "IsDotNet2orGreater: $($FWver.PSChildName) is present " | Out-Null
$bVersionPresent = $true
break
}
else
{
Write-LogFileEntry "IsDotNet2orGreater: $($FWver.PSChildName) is not .NET 3.5. Checking next higher version." | Out-Null
}
}
Write-LogFileEntry "IsDotNet2orGreater: .NET 2.0 checker returned $bVersionPresent." | Out-Null
return $bVersionPresent
}