Hello.
I ran your script and noticed messages in log:
Check Hyper-V status
Hyper-V is disabled.
...
Due to the installed Hyper-V role, the optimization of the PACKET COALESCING FILTER ON WINDOWS TCP-STACK is skipped.
Due to the installed Hyper-V role, the optimization of the RECEIVE SIDE SCALING on Windows TCP-Stack is skipped.
Then I went into ps1-file itself to see the commands and noticed that the variable $HYPERVSTATE is initialized:
$HYPERVSTATE = Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V | Select-Object State | Select State -ExpandProperty State | Out-String -Stream
which on my PC gets $null because cmdlet "Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V" returns nothing.
So the next check is going OK
if($HYPERVSTATE -eq "Enabled")
{
Write-Host " Hyper-V is enabled." -ForegroundColor Yellow
}
else
{
Write-Host " Hyper-V is disabled." -ForegroundColor Green
}
But following check is not OK:
if ($HYPERVSTATE -eq "Disabled")
because $HYPERVSTATE is $null (in my case).
So the correct way to check would be:
if ($HYPERVSTATE -ne "Enabled")
PS I guess Home edition of Windows has no Hyper-V at all, hence Get-WindowsOptionalFeature returns nothing.
Hello. I ran your script and noticed messages in log:
Then I went into ps1-file itself to see the commands and noticed that the variable $HYPERVSTATE is initialized:
which on my PC gets $null because cmdlet "Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V" returns nothing.
So the next check is going OK
But following check is not OK:
because $HYPERVSTATE is $null (in my case). So the correct way to check would be:
PS I guess Home edition of Windows has no Hyper-V at all, hence Get-WindowsOptionalFeature returns nothing.