Skip to content

Commit 6536e0a

Browse files
authored
Merge pull request MicrosoftDocs#3602 from matthewige/main
Add Hyper-V firewall powershell cmdlet documentation
2 parents c702ccb + 4881019 commit 6536e0a

15 files changed

+4215
-0
lines changed
Lines changed: 344 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,344 @@
1+
---
2+
description: Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell.
3+
external help file: NetFirewallHyperVRule.cmdletDefinition.cdxml-help.xml
4+
Module Name: NetSecurity
5+
ms.date: 8/25/2023
6+
online version: https://docs.microsoft.com/powershell/module/netsecurity/disable-netfirewallhypervrule?view=windowsserver2022-ps&wt.mc_id=ps-gethelp
7+
schema: 2.0.0
8+
title: Disable-NetFirewallHyperVRule
9+
---
10+
11+
# Disable-NetFirewallHyperVRule
12+
13+
## SYNOPSIS
14+
Disables one or more Hyper-V firewall rules that match the specified criteria.
15+
16+
## SYNTAX
17+
18+
### GetAll (Default)
19+
```
20+
Disable-NetFirewallHyperVRule [-All] [-PolicyStore <string>] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
21+
```
22+
23+
### ByName
24+
```
25+
Disable-NetFirewallHyperVRule [-Name] <string[]> [-PolicyStore <string>] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
26+
```
27+
28+
### ByDisplayName
29+
```
30+
Disable-NetFirewallHyperVRule -DisplayName <string[]> [-PolicyStore <string>] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
31+
```
32+
33+
### ByQuery
34+
```
35+
Disable-NetFirewallHyperVRule [-Direction {Inbound | Outbound}] [-VMCreatorId <string[]>] [-Protocol <string[]>] [-Action {NotConfigured | Allow | Block}] [-Enabled {True | False}] [-EnforcementStatus {Unknown | OK | PartiallyEnforced | NoApplicablePorts | ParsingError | Error}] [-PolicyStoreSourceType {None | Local | MDM}] [-PolicyStore <string>] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
36+
```
37+
38+
### InputObject (cdxml)
39+
```
40+
Disable-NetFirewallHyperVRule -InputObject <CimInstance#MSFT_NetFirewallHyperVRule[]> [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
41+
```
42+
43+
## DESCRIPTION
44+
45+
**Important**: Running this cmdlet without parameters disables all Windows Hyper-V firewall rules on the target computer. Always run this cmdlet with the WhatIf parameter if you are not targeting a specific Windows Hyper-V firewall rule.
46+
47+
48+
The **Disable-NetFirewallHyperVRule** cmdlet disables a previously enabled Hyper-V firewall rule to be inactive. A disabled rule will not actively modify system behavior, but the rule still exists on the computer so it can be re-enabled later. This is different from the Remove-NetFirewallHyperVRule cmdlet, which will permanently remove the rule.
49+
50+
51+
This cmdlet disables one or more Hyper-V firewall rules with the Name parameter, DisplayName parameter, or rule properties.
52+
53+
Disabling Hyper-V firewall rules can be useful for debugging Hyper-V firewall policy mismatch issues.
54+
55+
## EXAMPLES
56+
57+
### EXAMPLE 1
58+
```
59+
PS C:\> Disable-NetFirewallHyperVRule -PolicyStore ActiveStore
60+
```
61+
62+
This example retrieves all the Hyper-V firewall rules in the active store, which is a collection of all the policy stores that apply to the computer, and disables all of them.
63+
64+
65+
### EXAMPLE 2
66+
```
67+
PS C:\> Disable-NetFirewallHyperVRule -DisplayName 'MyServerIPBlock'
68+
```
69+
70+
This example retrieves all the Hyper-V firewall rules with DisplayName 'MyServerIPBlock' and disables the rules.
71+
72+
73+
## PARAMETERS
74+
75+
### -Action
76+
Specifies that matching Hyper-V firewall rules of the indicated action are disabled.
77+
The acceptable values for this parameter are: Allow or Block.
78+
79+
- Allow: Network packets that match all criteria specified in this rule are permitted through the firewall.
80+
This is the default value.
81+
- Block: Network packets that match all criteria specified in this rule are dropped by the firewall.
82+
83+
```yaml
84+
Type: Action
85+
Parameter Sets: (All)
86+
Aliases:
87+
Accepted values: NotConfigured, Allow, Block
88+
Required: False
89+
Position: Named
90+
Default value: None
91+
Accept pipeline input: False
92+
Accept wildcard characters: False
93+
```
94+
95+
### -AsJob
96+
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
97+
98+
```yaml
99+
Type: SwitchParameter
100+
Parameter Sets: (All)
101+
Aliases:
102+
Required: False
103+
Position: Named
104+
Default value: None
105+
Accept pipeline input: False
106+
Accept wildcard characters: False
107+
```
108+
109+
### -CimSession
110+
Runs the cmdlet in a remote session or on a remote computer.
111+
Enter a computer name or a session object, such as the output of a [New-CimSession](https://go.microsoft.com/fwlink/p/?LinkId=227967) or [Get-CimSession](https://go.microsoft.com/fwlink/p/?LinkId=227966) cmdlet.
112+
The default is the current session on the local computer.
113+
114+
```yaml
115+
Type: CimSession[]
116+
Parameter Sets: (All)
117+
Aliases: Session
118+
Required: False
119+
Position: Named
120+
Default value: None
121+
Accept pipeline input: False
122+
Accept wildcard characters: False
123+
```
124+
125+
### -Direction
126+
Specifies that matching Hyper-V firewall rules of the indicated direction are disabled.
127+
This parameter specifies which direction of traffic to match with this rule.
128+
The acceptable values for this parameter are: Inbound or Outbound.
129+
130+
```yaml
131+
Type: Direction
132+
Parameter Sets: (All)
133+
Aliases:
134+
Accepted values: Inbound, Outbound
135+
Required: False
136+
Position: Named
137+
Default value: Inbound
138+
Accept pipeline input: False
139+
Accept wildcard characters: False
140+
```
141+
142+
### -DisplayName
143+
Specifies that only matching Hyper-V firewall rules of the indicated display name are disabled. Wildcard characters are accepted.
144+
145+
```yaml
146+
Type: String
147+
Parameter Sets: (All)
148+
Aliases:
149+
Required: True
150+
Position: Named
151+
Default value: None
152+
Accept pipeline input: False
153+
Accept wildcard characters: False
154+
```
155+
156+
### -Enabled
157+
Specifies that matching Hyper-V firewall rules of the indicated state are disabled.
158+
This parameter specifies that the rule object is administratively enabled or administratively disabled.
159+
The acceptable values for this parameter are:
160+
- True: Specifies the rule is currently enabled.
161+
- False: Specifies the rule is currently disabled.
162+
163+
Note that the type of this parameter is not Boolean, therefore `$true` and `$false` variables are not acceptable values here. Use "True" and "False" text strings instead.
164+
165+
166+
A disabled rule will not actively modify computer behavior, but the management construct still exists on the computer so it can be re-enabled.
167+
168+
```yaml
169+
Type: Enabled
170+
Parameter Sets: (All)
171+
Aliases:
172+
Accepted values: True, False
173+
Required: False
174+
Position: Named
175+
Default value: True
176+
Accept pipeline input: False
177+
Accept wildcard characters: False
178+
```
179+
180+
### -EnforcementStatus
181+
Specifies that firewall rules that match the indicated enforcement status are disabled.
182+
This parameter specifies the overall status of the rule.
183+
- OK: Specifies that the rule will work as specified.
184+
- PartiallyEnforced: Specifies that one or more parts of the rule will not be enforced.
185+
- NoApplicablePorts: Specifies that the rule is functioning as expected, but there are no ports applicable for this rule and therefore is not active.
186+
- ParsingError: Specifies that the rule is corrupted and the computer is unable to use the rule at all.
187+
- Error: Specifies that the computer is unable to use the rule at all.
188+
189+
```yaml
190+
Type: PrimaryStatus[]
191+
Parameter Sets: ByQuery
192+
Aliases:
193+
Accepted values: Unknown, OK, Inactive, Error
194+
195+
Required: False
196+
Position: Named
197+
Default value: None
198+
Accept pipeline input: False
199+
Accept wildcard characters: False
200+
```
201+
202+
203+
### -Name
204+
Specifies that only matching Hyper-V firewall rules of the indicated name are disabled.
205+
This name serves as the unique identifier for this rule. This parameter acts just like a file name, in that only one rule with a given name may exist in a policy store at a time.
206+
207+
```yaml
208+
Type: String
209+
Parameter Sets: (All)
210+
Aliases: ID
211+
Required: False
212+
Position: Named
213+
Default value: None
214+
Accept pipeline input: False
215+
Accept wildcard characters: False
216+
```
217+
218+
### -PolicyStore
219+
Targets the policy store from which to disable the rules.
220+
A policy store is a container for firewall policy.
221+
The acceptable values for this parameter are:
222+
- PersistentStore: Sometimes called static rules, this store contains the persistent policy for the local computer.
223+
This policy is not from GPOs, and has been created manually or programmatically (during application installation) on the computer.
224+
Rules created in this store are attached to the ActiveStore and activated on the computer immediately.
225+
- ActiveStore: This store contains the currently active policy, which is the sum of all policy stores that apply to the computer.
226+
- SystemDefaults: This read-only store contains the default state of firewall rules.
227+
- MDM: This store contains the rules configured via MDM.
228+
229+
By default, the PersistentStore is queried.
230+
231+
```yaml
232+
Type: String
233+
Parameter Sets: (All)
234+
Aliases:
235+
236+
Required: False
237+
Position: Named
238+
Default value: None
239+
Accept pipeline input: False
240+
Accept wildcard characters: False
241+
```
242+
243+
### -PolicyStoreSourceType
244+
Specifies that Hyper-V firewall rules that match the indicated policy store source type are disabled.
245+
This parameter value is automatically generated and should not be modified.
246+
The acceptable values for this parameter are:
247+
- Local: The object originates from the local store.
248+
- MDM: The object originates from the MDM store.
249+
250+
By default, the Local store is queried.
251+
252+
```yaml
253+
Type: PolicyStoreType[]
254+
Parameter Sets: ByQuery
255+
Aliases:
256+
Accepted values: None, Local, MDM
257+
258+
Required: False
259+
Position: Named
260+
Default value: None
261+
Accept pipeline input: False
262+
Accept wildcard characters: False
263+
```
264+
265+
### -Protocol
266+
Specifies that only matching Hyper-V firewall rules with the indicated Protocol are disabled.
267+
The acceptable values for this parameter are:
268+
- Protocols by number: 0-255.
269+
- Protocols by name: TCP, UDP, ICMPv4, or ICMPv6.
270+
271+
```yaml
272+
Type: String
273+
Parameter Sets: (All)
274+
Aliases:
275+
Required: False
276+
Position: Named
277+
Default value: None
278+
Accept pipeline input: False
279+
Accept wildcard characters: False
280+
```
281+
282+
### -ThrottleLimit
283+
Specifies the maximum number of concurrent operations that can be established to run the cmdlet.
284+
If this parameter is omitted or a value of `0` is entered, Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer.
285+
286+
The throttle limit applies only to the current cmdlet, not to the session or to the computer.
287+
288+
```yaml
289+
Type: Int32
290+
Parameter Sets: (All)
291+
Aliases:
292+
Required: False
293+
Position: Named
294+
Default value: None
295+
Accept pipeline input: False
296+
Accept wildcard characters: False
297+
```
298+
299+
### -VMCreatorId
300+
Specifies that only matching Hyper-V firewall rules with the specified VMCreatorId are disabled.
301+
The format for this value is a GUID enclosed in brackets, such as '{9E288F02-CE00-4D9E-BE2B-14CE463B0298}'.
302+
303+
304+
```yaml
305+
Type: String
306+
Parameter Sets: (All)
307+
Aliases:
308+
Required: False
309+
Position: Named
310+
Default value: None
311+
Accept pipeline input: False
312+
Accept wildcard characters: False
313+
```
314+
315+
### CommonParameters
316+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
317+
318+
## INPUTS
319+
320+
### None
321+
322+
## OUTPUTS
323+
324+
### Microsoft.Management.Infrastructure.CimInstance#root\StandardCimv2\NetFirewallHyperVRule
325+
The `Microsoft.Management.Infrastructure.CimInstance` object is a wrapper class that displays Windows Management Instrumentation (WMI) objects.
326+
The path after the pound sign (`#`) provides the namespace and class name for the underlying WMI object.
327+
328+
## NOTES
329+
330+
## RELATED LINKS
331+
332+
[New-NetFirewallHyperVRule](./New-NetFirewallHyperVRule.md)
333+
334+
[Get-NetFirewallHyperVRule](./Get-NetFirewallHyperVRule.md)
335+
336+
[Disable-NetFirewallHyperVRule](./Disable-NetFirewallHyperVRule.md)
337+
338+
[Remove-NetFirewallHyperVRule](./Remove-NetFirewallHyperVRule.md)
339+
340+
[Rename-NetFirewallHyperVRule](./Rename-NetFirewallHyperVRule.md)
341+
342+
[Set-NetFirewallHyperVRule](./Set-NetFirewallHyperVRule.md)
343+
344+
[Get-NetfirewallHyperVVMCreator](./Get-NetFirewallHyperVVMCreator.md)

0 commit comments

Comments
 (0)