This script will build a powershell script from a CSV file you have created for bulk DHCP reservations. Change what is highlighted for your needs.
##==============================================================================
##==============================================================================
## SCRIPT.........: Create-Reservation.ps1
## AUTHOR.........: Clint McGuire
## EMAIL..........:
## VERSION........: 1
## DATE...........: 2011-1-23
## COPYRIGHT......: 2011, Clint McGuire
## LICENSE........:
## REQUIREMENTS...: Powershell v2.0
##
## DESCRIPTION....: Creates an CMD file to add reservations to DHCP.
##
## NOTES..........: Requires CSV file with 3 fields, IP, MAC and NAME
##
## CUSTOMIZE......:
##==============================================================================
## START
##==============================================================================
$DHCPServer = "X.X.X.X"
$DHCPscope = "X.X.X.X"
$outputfile = "C:\scripts\PSScriptsnetshoutput.cmd"
# Assumes a CSV with three columns, MAC, IP and NAME.
$ips = import-csv "c:filename.csv"
$ips | %{
add-content -Encoding ASCII -Path $outputfile -Value "netsh Dhcp Server $DHCPServer Scope $DHCPScope Add reservedip $($_.IP) $($_.MAC) `"$($_.NAME)`" `"$($_.NAME)`" `"BOTH`""
}
##==============================================================================
## END
may I use in Centos ?
ReplyDeleteNot sure. You are welcome to try. Let me know the results.
Delete