-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9054e10
commit aa6840e
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
modules/AdminToolbox.FortiWizard/Private/New-LocalInAddressObject.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#Required By Function | ||
#New-LocalInPolicy | ||
|
||
Function New-LocalInAddressObject { | ||
|
||
[CmdletBinding()] | ||
Param ( | ||
[Parameter(Mandatory = $true)]$AddressName, | ||
[Parameter(Mandatory = $true)] | ||
[ValidateScript( { | ||
if ($_ -match '^[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}[.]{1}[0-9]{1,3}[/]{1}[0-9]{1,2}$') { | ||
$true | ||
} | ||
else { | ||
throw "$_ is an invalid pattern. You must provide a proper CIDR format. ex: 192.168.0.0/24" | ||
} | ||
})] | ||
$CIDR | ||
) | ||
|
||
$calc = Invoke-PSipcalc $cidr | ||
$IPAddress = ($calc).IP | ||
$SubnetMask = ($calc).SubnetMask | ||
|
||
Write-Output " | ||
config firewall address | ||
edit ""$AddressName"" | ||
set subnet $IPAddress $SubnetMask | ||
set allow-routing enable | ||
next | ||
end" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters