##==============================================================================
## SCRIPT.........:Create-Reservation.ps1
## NOTES..........:Requires CSV file with 4 fields, IP, MAC, NAME and DESC
##==============================================================================
# IP address of DHCP server
$DHCPServer = "127.0.0.1"
# DHCP Scope you'dlike reservations created for
$DHCPscope = "10.10.1.0"
# Stores current date& time in a sortable format
$date = Get-Date -format s
# Name of output batchfile
$outputfile = "C:\DHCPreservationsNaNd"
# Assumes a CSV withfour columns, MAC, IP, NAME and DESC.
$ips = import-csv "C:\input.csv"
$ips | %{
add-content -Encoding ASCII -Path $outputfile-Value "netsh Dhcp Server $DHCPServer Scope $DHCPScope Add reservedip$($_.IP) $($_.MAC) `"$($_.NAME)`" `"$date - $($_.DESC)`"`"DHCP`""
}
##==============================================================================
## END
##===========================