Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Shall script-DHCP installation and configuration

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

$dhcpscope=read-host-Prompt "Please enter dhcp scope address"

$scopename=Read-Host-Prompt "Please enter dhcp scope name"

$scopedescript=Read-Host-Prompt "Please enter a description of the dhcp scope"

# get the current computer name #

$Hostname=$env:COMPUTERNAME

# get the fully qualified domain name of this machine #

$fqdnname= ([system.net.dns]:: gethostentry ($Hostname)) .Hostname

$iprangea=Read-Host-Prompt "Please enter dhcp to assign the starting address"

$iprangeb=Read-Host-Prompt "Please enter the dhcp assignment end address"

$ipexcludea=Read-Host-Prompt "Please enter dhcp to exclude the starting address"

$ipexcludeb=Read-Host-Prompt "Please enter dhcp exclusion end address"

$ipgateway=Read-Host-Prompt "Please enter the gateway address assigned by dhcp"

$ipdns=Read-Host-Prompt "Please enter the dns address assigned by dhcp"

# automatically install DHCP service in windows server 2008 #

ServerManagercmd-I dhcp

# set the DHCP service startup mode to automatic #

Get-Service dhcpserver | Set-Service-StartupType automatic

# start the DHCP service #

Start-Service dhcpserver

# add address scope #

Netsh dhcp server add scope $dhcpscope 255.255.255.0$ scopename $scopedescript

# add DHCP service authorization to active Directory #

Netsh dhcp add server $fqdnname

# add IP address range in DHCP service #

Netsh dhcp server scope $dhcpscope add iprange $iprangea $iprangeb dhcp

# add an excluded address to the distribution domain #

Netsh dhcp server scope $dhcpscope add excluderange $ipexcludea $ipexcludeb

# add the distribution gateway address to the DHCP service #

Netsh dhcp server scope $dhcpscope set optionvalue 003 ipaddress $ipgateway

# add a DNS address to the DHCP service #

Netsh dhcp server scope $dhcpscope set optionvalue 006 ipaddress $ipdns

# activate the DHCP distribution domain #

Netsh dhcp server scope $dhcpscope set state 1

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 280

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report