Skip to content

Add-RouterOsIpDhcpServerNetwork

SYNOPSIS

Add DHCP network

SYNTAX

Default

Add-RouterOsIpDhcpServerNetwork [-ComputerName] <String> [-Port] <Int32> [-Credential] <PSCredential>
 [-ShowCommand] [-Address <String>] [-BootFileName <String>] [-CapsManager <String>] [-Comment <String>]
 [-CopyFrom <String>] [-DhcpOption <String>] [-DhcpOptionSet <String>] [-DnsNone <String>]
 [-DnsServer <String>] [-Domain <String>] [-Gateway <String>] [-Netmask <String>] [-NextServer <String>]
 [-NtpServer <String>] [-WinsServer <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

Session

Add-RouterOsIpDhcpServerNetwork [-ShowCommand] -Session <RouterOsSession> [-Address <String>]
 [-BootFileName <String>] [-CapsManager <String>] [-Comment <String>] [-CopyFrom <String>]
 [-DhcpOption <String>] [-DhcpOptionSet <String>] [-DnsNone <String>] [-DnsServer <String>] [-Domain <String>]
 [-Gateway <String>] [-Netmask <String>] [-NextServer <String>] [-NtpServer <String>] [-WinsServer <String>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Add DHCP network

EXAMPLES

Example

Using Session
$Credential = $([pscredential]::New('admin',$(ConvertTo-SecureString -String 'admin' -AsPlainText -Force)))
$session = New-RouterOsSession -ComputerName '10.0.0.1' -Port 22 -Credential $Credential
Add-RouterOsIpDhcpServerNetwork -Session $session -Address "192.168.1.0/24" -DnsServer "192.168.1.1" -Gateway "192.168.1.1" -Domain "lab.local"
Remove-RouterOsSession -Session $session
RouterOS CLI
/ip dhcp-server network add address=192.168.1.0/24 dns-server=192.168.1.1 gateway=192.168.1.1 domain=lab.local

Example

Using PSCredential
$Credential = $([pscredential]::New('admin',$(ConvertTo-SecureString -String 'admin' -AsPlainText -Force)))
Add-RouterOsIpDhcpServerNetwork -ComputerName '10.0.0.1' -Port 22 -Credential $Credential -Address "192.168.1.0/24" -DnsServer "192.168.1.1" -Gateway "192.168.1.1" -Domain "lab.local"
RouterOS CLI
/ip/dhcp-server/network/add address=192.168.1.0/24 dns-server=192.168.1.1 gateway=192.168.1.1 domain=lab.local

PARAMETERS

-Address

{{ Fill Address Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-BootFileName

{{ Fill BootFileName Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CapsManager

{{ Fill CapsManager Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Comment

{{ Fill Comment Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ComputerName

{{ Fill ComputerName Description }}

Type: String
Parameter Sets: Default
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-CopyFrom

{{ Fill CopyFrom Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Credential

{{ Fill Credential Description }}

Type: PSCredential
Parameter Sets: Default
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-DhcpOption

{{ Fill DhcpOption Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DhcpOptionSet

{{ Fill DhcpOptionSet Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DnsNone

{{ Fill DnsNone Description }}

Type: String
Parameter Sets: (All)
Aliases:
Accepted values: yes, no

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DnsServer

{{ Fill DnsServer Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Domain

{{ Fill Domain Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Gateway

{{ Fill Gateway Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Netmask

{{ Fill Netmask Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NextServer

{{ Fill NextServer Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NtpServer

{{ Fill NtpServer Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Port

{{ Fill Port Description }}

Type: Int32
Parameter Sets: Default
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Session

{{ Fill Session Description }}

Type: RouterOsSession
Parameter Sets: Session
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ShowCommand

{{ Fill ShowCommand Description }}

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WinsServer

{{ Fill WinsServer Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

System.Int32

System.Management.Automation.PSCredential

psrouteros.Helper.RouterOsSession

OUTPUTS

System.Void

NOTES