-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathTest-PowershellVersion.ps1
More file actions
50 lines (36 loc) · 1.86 KB
/
Test-PowershellVersion.ps1
File metadata and controls
50 lines (36 loc) · 1.86 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
<#
.SYNOPSIS
This function ensures the code executes only in Powershell 5.1 until other module dependencies are corrected.
.DESCRIPTION
This function ensures the code executes only in Powershell 5.1 until other module dependencies are corrected.
.EXAMPLE
Test-PowershellVersion
#>
Function Test-PowershellVersion
{
[cmdletbinding()]
$functionPowerShellVersion = $NULL
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN TEST-POWERSHELLVERSION"
Out-LogFile -string "********************************************************************************"
#Write function parameter information and variables to a log file.
$functionPowerShellVersion = $PSVersionTable.PSVersion
out-logfile -string "Determining powershell version."
out-logfile -string ("Major: "+$functionPowerShellVersion.major)
out-logfile -string ("Minor: "+$functionPowerShellVersion.minor)
out-logfile -string ("Patch: "+$functionPowerShellVersion.patch)
out-logfile -string $functionPowerShellVersion
if ($functionPowerShellVersion.Major -ge 7)
{
out-logfile -string "Powershell 7 and higher is currently not supported due to module compatibility issues."
out-logfile -string "Please run module from Powershell 5.x"
out-logfile -string "" -isError:$true
}
else
{
out-logfile -string "Powershell version is not powershell 7.1 proceed."
}
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "END TEST-POWERSHELLVERSION"
Out-LogFile -string "********************************************************************************"
}