Last active
November 25, 2017 14:27
-
-
Save varunvns/400169cf77240cd89a9eafab65b8bb89 to your computer and use it in GitHub Desktop.
Add Website Binding to Hostfile
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
<# | |
.SYNOPSIS | |
This PowerShell Scrip Adds the website name given by the user to the Hosts file pointing to 127.0.0.1 | |
Author: Varun Shringarpure | |
#> | |
Write-Host "Hosts File prior to adding the website binding" | |
Get-Content C:\Windows\System32\drivers\etc\hosts | |
Write-Host "Lets add the required binding to the Host File " | |
$websiteBindingName = Read-Host -Prompt 'Provide website binding to be added to the Hosts File:' | |
Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "127.0.0.1 $websiteBindingName" | |
Write-Host "Hosts File after to adding the website binding" | |
Get-Content C:\Windows\System32\drivers\etc\hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment