PowerShell script to create numerous DHCP scopes

Let's say you need to create a whole bunch of DHCP scopes in the Windows DHCP server, and you don't feel like spending hours using the wizard, or manually constructing all the netsh commands you need to do it from the command line. I had this very problem last week, so I hacked together this script to take a CSV file with all the details needed for the scopes, and output a .cmd file that I can simply run against my DHCP server to create them all. I've only included the DHCP options for router address, DNS servers, and DNS suffix, but you could certainly add more.

##==============================================================================
##==============================================================================
## SCRIPT.........: Create-Scope.ps1 
## AUTHOR.........: Seth H. Bokelman 
## EMAIL..........: seth.bokelman@uni.edu 
## VERSION........: 1 
## DATE...........: 2012-04-030 
## REQUIREMENTS...: Powershell v2.0 
## 
## DESCRIPTION....: Creates a CMD file to create numerous DHCP scopes 
## 
## NOTES..........: Requires CSV file with these fields: SCOPE, MASK, NAME, DESC 
## ROUTER, STARTIP, ENDIP, DNSSUFFIX 
## CUSTOMIZE......: 
##============================================================================== 
## START 
##============================================================================== 
# IP address of DHCP server 
$DHCPServer = "127.0.0.1"

#IP address of DNS servers 
$DNS1 = "127.0.0.1" 
$DNS2 = "127.0.0.1"

# Stores current date & time in a sortable format 
$date = Get-Date -format s

# Name of output batch file 
$outputfile = "C:DHCPscopes.cmd"

# Assumes a CSV with 8 columns listed above. 
$ips = import-csv "C:input.csv"

$ips | %{
add-content -Encoding ASCII -Path $outputfile -Value "netsh dhcp server $DHCPServer add scope $($_.SCOPE) $($_.MASK) `"$($_.NAME)`" `"$date - $($_.DESC)`""
add-content -Encoding ASCII -Path $outputfile -Value "netsh dhcp server $dhcpserver scope $($_.SCOPE) set optionvalue 3 IPADDRESS $($_.ROUTER)"
add-content -Encoding ASCII -Path $outputfile -Value "netsh dhcp server $dhcpserver scope $($_.SCOPE) set optionvalue 6 IPADDRESS $DNS1 $DNS2"
add-content -Encoding ASCII -Path $outputfile -Value "netsh dhcp server $dhcpserver scope $($_.SCOPE) set optionvalue 15 STRING `"$($_.DNSSUFFIX)`""
add-content -Encoding ASCII -Path $outputfile -Value "netsh dhcp server $dhcpserver scope $($_.SCOPE) add iprange $($_.STARTIP) $($_.ENDIP)"
add-content -Encoding ASCII -Path $outputfile -Value "netsh dhcp server $DHCPserver scope $($_.SCOPE) set state 1"
}
##==============================================================================
## END
##==============================================================================