win_firewall- Change req check from wmf version to cmdlets presence (#64998)

This commit is contained in:
Shachaf92 2019-11-20 03:00:56 +02:00 committed by Jordan Borean
parent f5133bec22
commit 96a422a6fc
2 changed files with 8 additions and 2 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- "win_firewall- Change req check from wmf version to cmdlets presence - https://github.com/ansible/ansible/issues/63003"

View file

@ -20,8 +20,12 @@ $result = @{
state = $state
}
if ($PSVersionTable.PSVersion -lt [Version]"5.0") {
Fail-Json $result "win_firewall requires Windows Management Framework 5 or higher."
try {
get-command Get-NetFirewallProfile > $null
get-command Set-NetFirewallProfile > $null
}
catch {
Fail-Json $result "win_firewall requires Get-NetFirewallProfile and Set-NetFirewallProfile Cmdlets."
}
Try {