Skip to content

Commit 81fdb80

Browse files
committed
Removed check for hyper-v
1 parent 4501244 commit 81fdb80

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

internal/scripts/preimport.ps1

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Check if window is in elevated mode
22
$elevated = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
33
if ( -not $elevated ) {
4-
Stop-PSFFunction -Message "Module requires elevation" -Target $elevated -FunctionName 'Pre Import'
4+
Stop-PSFFunction -Message "Module requires elevation" -Target $elevated -FunctionName 'Pre Import'
55
}
66

77
# Set the supported version of Windows
@@ -20,23 +20,7 @@ $osDetails = Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Desc
2020
# Check which version of windows we're dealing with
2121
if ($osDetails.Caption -notin $supportedVersions ) {
2222
if ($osDetails.Caption -like '*Windows 7*') {
23-
Stop-PSFFunction -Message "Module can not work on Windows 7" -Target $OSDetails -FunctionName 'Pre Import'
24-
}
25-
elseif ($osDetails.Caption -like '*Windows 10*') {
26-
$feature = Get-WindowsOptionalFeature -FeatureName 'Microsoft-Hyper-V-All' -Online
27-
if ($feature.State -ne "Enabled") {
28-
Write-PSFMessage -Message "Hyper-V is not enabled, the module can only be used remotely.`nTo use the module locally execute the following command: `"Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All`"" -Level Warning -FunctionName 'Test-PSDCConfiguration'
29-
}
30-
31-
Stop-PSFFunction -Message "Module can only work on Windows 10 Pro, Enterprise or Education" -Target $OSDetails -FunctionName 'Pre Import'
32-
}
33-
elseif ($osDetails.Caption -like '*Windows Server*') {
34-
$feature = Get-WindowsFeature -Name 'Hyper-V'
35-
if (-not $feature.Installed) {
36-
Write-PSFMessage -Message "Hyper-V is not enabled, the module can only be used remotely.`nTo use the module execute the following command:`n `"Install-WindowsFeature -Name Hyper-V`"`n`"Install-WindowsFeature -Name Hyper-V-PowerShell`"" -Level Warning -FunctionName 'Pre Import'
37-
}
38-
39-
Stop-PSFFunction -Message "Module can only work on Windows Server 2012 R2 and up, Enterprise or Education" -Target $OSDetails -FunctionName 'Pre Import'
23+
Stop-PSFFunction -Message "Module does not work on Windows 7" -Target $OSDetails -FunctionName 'Pre Import'
4024
}
4125
else {
4226
Stop-PSFFunction -Message "Unsupported version of Windows." -Target $OSDetails -FunctionName 'Pre Import'

0 commit comments

Comments
 (0)