Created
August 10, 2011 20:30
-
-
Save toddb/1138154 to your computer and use it in GitHub Desktop.
Update host file in psake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Property { | |
$domain = "" | |
} | |
Task Hostfile-Update -Description "Add new sites to the host file" { | |
$host_file = "$env:windir\System32\drivers\etc\hosts" | |
if ((Get-Content $host_file | ForEach-Object{$_ -eq "127.0.0.1 $domain "}) -notcontains "True") | |
{ | |
Add-Content $host_file "`n127.0.0.1 $domain " | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment