共用方式為


New-SCPortACLRule

New-SCPortACLRule

Creates a port ACL rule.

Syntax

Parameter Set: Default
New-SCPortACLRule [-Name] <String> -Action <PortACLRuleAction> {Allow | Deny} -PortACL <PortACL> -Priority <UInt16> -Protocol <PortACLRuleProtocol> {Tcp | Udp | Any} -Type <PortACLRuleDirection> {Inbound | Outbound} [-Description <String> ] [-DestinationAddressPrefix <String> ] [-DestinationPortRange <String> ] [-JobVariable <String> ] [-OnBehalfOfUser <String> ] [-OnBehalfOfUserRole <UserRole> ] [-PROTipID <Guid> ] [-RunAsynchronously] [-SourceAddressPrefix <String> ] [-SourcePortRange <String> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Detailed Description

The New-SCPortACLRule cmdlet creates a port Access Control List (ACL) rule.

Parameters

-Action<PortACLRuleAction>

Specifies the action of the ACL rule.
The acceptable values for this parameter are:

-- Allow
-- Deny

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Description<String>

Specifies the description of the port ACL rule.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DestinationAddressPrefix<String>

Specifies the destination address prefix of the port ACL.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DestinationPortRange<String>

Specifies the destination port range.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

Specifies that job progress is tracked and stored in the variable named by this parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of the new port ACL rule.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUser<String>

Specifies a user name. This cmdlet operates on behalf of the user that this parameter specifies.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUserRole<UserRole>

Specifies a user role. To obtain a user role, use the Get-SCUserRole cmdlet. This cmdlet operates on behalf of the user role that this parameter specifies.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PortACL<PortACL>

Specifies the port ACL value.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

-Priority<UInt16>

Specifies the priority of port ALC rule. The valid values for this parameter are between 1 and 65535.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid>

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Protocol<PortACLRuleProtocol>

Specifies the protocol in which this cmdlet applies to the port ACL.

The acceptable values for this parameter are:
-- Tcp
-- Udp
-- Any

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SourceAddressPrefix<String>

Specifies the source address prefix that this cmdlet applies to the port ACL rule.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SourcePortRange<String>

Specifies the source port range which this cmdlet applies to the port ACL rule.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Type<PortACLRuleDirection>

Specifies the direction of the port ACL.

The acceptable values for this parameter are:
-- Inbound
-- Outbound

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a Virtual Machine Manager (VMM) Server object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Create a port ACL rule

The first command gets the port ACL named SampleRule and stores it in the variable named $Acl. The second command creates a port ACL rule named AllowSMBIn that is of type Inbound and has a priority value of 10.

PS C:\> $Acl = Get-SCPortACLRule -Name "SampleRule" 
PS C:\> New-SCPortACLRule -Name "AllowSMBIn" -Description "Allow inbound TCP Port 445" -Type Inbound -Protocol TCP -Action Allow -PortACL $Acl -SourcePortRange 445 -Priority 10

Get-SCPortACLRule

Remove-SCPortACLRule

Set-SCPortACLRule

Get-SCUserRole