Skip to content

Commit d8405f1

Browse files
Merge pull request #1609 from JeremyCamplin/master
Updated check .net framework set template for Windows 11
2 parents cbda504 + ad84197 commit d8405f1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

step-templates/windows-check-net-framework-version.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"Name": ".NET - Check .NET Framework Version",
44
"Description": "Check if given .NET framework version (or greater) is installed.",
55
"ActionType": "Octopus.Script",
6-
"Version": 8,
6+
"Version": 9,
77
"CommunityActionTemplateId": "CommunityActionTemplates-561",
88
"Properties": {
99
"Octopus.Action.Script.Syntax": "PowerShell",
1010
"Octopus.Action.Script.ScriptSource": "Inline",
11-
"Octopus.Action.Script.ScriptBody": "# This script is based on MSDN: https://msdn.microsoft.com/en-us/library/hh925568\n\n$releaseVersionMapping = @{\n 378389 = '4.5' # 4.5\n 378675 = '4.5.1' # 4.5.1 installed with Windows 8.1\n 378758 = '4.5.1' # 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2\n 379893 = '4.5.2' # 4.5.2\n 393295 = '4.6' # 4.6 installed with Windows 10\n 393297 = '4.6' # 4.6 installed on all other Windows OS versions\n 394254 = '4.6.1' # 4.6.1 installed on Windows 10\n 394271 = '4.6.1' # 4.6.1 installed on all other Windows OS versions\n 394802 = '4.6.2' # 4.6.2 installed on Windows 10\n 394806 = '4.6.2' # 4.6.2 installed on all other Windows OS versions\n 460798 = '4.7' # 4.7 installed on Windows 10\n 460805 = '4.7' # 4.7 installed on all other Windows OS versions\n 461308 = '4.7.1' # 4.7.1 installed on Windows 10\n 461310 = '4.7.1' # 4.7.1 installed on all other Windows OS versions\n 461808 = '4.7.2' # 4.7.2 installed on Windows 10\n 461814 = '4.7.2' # 4.7.2 installed on all other Windows OS versions\n 528040 = '4.8' #4.8 installed on Windows 10\n 528049 = '4.8' #4.8 installed on all other Windows OS versions1\n 528372 = '4.8' # 4.8 Windows 10 May 2020 Update\n}\n\nfunction Get-DotNetFrameworkVersions() {\n $dotNetVersions = @()\n if ($baseKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', '')) {\n # To find .NET Framework versions (.NET Framework 1-4)$dotNetVersions\n if ($ndpKey = $baseKey.OpenSubKey('SOFTWARE\\Microsoft\\NET Framework Setup\\NDP')) {\n foreach ($versionKeyName in $ndpKey.GetSubKeyNames()) {\n if ($versionKeyName -match 'v[2|3]') {\n $versionKey = $ndpKey.OpenSubKey($versionKeyName)\n if ($versionKey.GetValue('Version', '') -ne '') {\n $version = [version] ($versionKey.GetValue('Version'))\n $dotNetVersions += \"$($version.Major).$($version.Minor)\"\n }\n }\n }\n \n # for .NET 4.0\n if ($ndp40Key = $ndpKey.OpenSubKey(\"v4.0\")) {\n foreach ($subKeyName in $ndp40Key.GetSubKeyNames()) {\n $versionKey = $ndp40Key.OpenSubKey($subKeyName)\n $version = [version]($versionKey.GetValue('Version', ''))\n $dotNetVersions += \"$($version.Major).$($version.Minor)\"\n }\n }\n }\n\n # To find .NET Framework versions (.NET Framework 4.5 and later)\n if ($ndp4Key = $baseKey.OpenSubKey('SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full')) {\n $releaseKey = $ndp4Key.GetValue('Release')\n $dotNetVersions += $releaseVersionMapping[$releaseKey]\n }\n }\n return $dotNetVersions\n}\n\n$targetVersion = $OctopusParameters['TargetVersion'].Trim()\n$exact = [boolean]::Parse($OctopusParameters['Exact'])\n\n$matchedVersions = Get-DotNetFrameworkVersions | Where-Object { if ($exact) { $_ -eq $targetVersion } else { $_ -ge $targetVersion } }\nif (!$matchedVersions) { \n throw \"Can't find .NET $targetVersion installed in the machine.\"\n}\n$matchedVersions | foreach { Write-Host \"Found .NET $_ installed in the machine.\" }",
11+
"Octopus.Action.Script.ScriptBody": "# This script is based on MSDN: https://msdn.microsoft.com/en-us/library/hh925568\n\n$releaseVersionMapping = @{\n 378389 = '4.5' # 4.5\n 378675 = '4.5.1' # 4.5.1 installed with Windows 8.1\n 378758 = '4.5.1' # 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2\n 379893 = '4.5.2' # 4.5.2\n 393295 = '4.6' # 4.6 installed with Windows 10\n 393297 = '4.6' # 4.6 installed on all other Windows OS versions\n 394254 = '4.6.1' # 4.6.1 installed on Windows 10\n 394271 = '4.6.1' # 4.6.1 installed on all other Windows OS versions\n 394802 = '4.6.2' # 4.6.2 installed on Windows 10\n 394806 = '4.6.2' # 4.6.2 installed on all other Windows OS versions\n 460798 = '4.7' # 4.7 installed on Windows 10\n 460805 = '4.7' # 4.7 installed on all other Windows OS versions\n 461308 = '4.7.1' # 4.7.1 installed on Windows 10\n 461310 = '4.7.1' # 4.7.1 installed on all other Windows OS versions\n 461808 = '4.7.2' # 4.7.2 installed on Windows 10\n 461814 = '4.7.2' # 4.7.2 installed on all other Windows OS versions\n 528040 = '4.8' # 4.8 installed on Windows 10\n 528049 = '4.8' # 4.8 installed on all other Windows OS versions1\n 528372 = '4.8' # 4.8 Windows 10 May 2020 Update\n 528449 = '4.8' # 4.8 Windows 11 and Windows Server 2022\n 533320 = '4.8.1' # 4.8 Windows 11 September 2022 Release and Windows 11 October 2023 Release\n 533325 = '4.8.1' # 4.8 all other OS versions\n}\n\nfunction Get-DotNetFrameworkVersions() {\n $dotNetVersions = @()\n if ($baseKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', '')) {\n # To find .NET Framework versions (.NET Framework 1-4)$dotNetVersions\n if ($ndpKey = $baseKey.OpenSubKey('SOFTWARE\\Microsoft\\NET Framework Setup\\NDP')) {\n foreach ($versionKeyName in $ndpKey.GetSubKeyNames()) {\n if ($versionKeyName -match 'v[2|3]') {\n $versionKey = $ndpKey.OpenSubKey($versionKeyName)\n if ($versionKey.GetValue('Version', '') -ne '') {\n $version = [version] ($versionKey.GetValue('Version'))\n $dotNetVersions += \"$($version.Major).$($version.Minor)\"\n }\n }\n }\n \n # for .NET 4.0\n if ($ndp40Key = $ndpKey.OpenSubKey(\"v4.0\")) {\n foreach ($subKeyName in $ndp40Key.GetSubKeyNames()) {\n $versionKey = $ndp40Key.OpenSubKey($subKeyName)\n $version = [version]($versionKey.GetValue('Version', ''))\n $dotNetVersions += \"$($version.Major).$($version.Minor)\"\n }\n }\n }\n\n # To find .NET Framework versions (.NET Framework 4.5 and later)\n if ($ndp4Key = $baseKey.OpenSubKey('SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full')) {\n $releaseKey = $ndp4Key.GetValue('Release')\n $dotNetVersions += $releaseVersionMapping[$releaseKey]\n }\n }\n return $dotNetVersions\n}\n\n$targetVersion = $OctopusParameters['TargetVersion'].Trim()\n$exact = [boolean]::Parse($OctopusParameters['Exact'])\n\n$matchedVersions = Get-DotNetFrameworkVersions | Where-Object { if ($exact) { $_ -eq $targetVersion } else { $_ -ge $targetVersion } }\nif (!$matchedVersions) { \n throw \"Can't find .NET $targetVersion installed in the machine.\"\n}\n$matchedVersions | foreach { Write-Host \"Found .NET $_ installed in the machine.\" }",
1212
"Octopus.Action.RunOnServer": "false"
1313
},
1414
"Parameters": [
@@ -40,6 +40,6 @@
4040
"OctopusVersion": "2018.4.1",
4141
"Type": "ActionTemplate"
4242
},
43-
"LastModifiedBy": "hullscotty1986",
43+
"LastModifiedBy": "JeremyCamplin",
4444
"Category": "aspnet"
45-
}
45+
}

0 commit comments

Comments
 (0)