Skip to content

Instantly share code, notes, and snippets.

@RobsonAutomator
Last active January 5, 2017 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobsonAutomator/51c8605235aac70314da9053c40475a2 to your computer and use it in GitHub Desktop.
Save RobsonAutomator/51c8605235aac70314da9053c40475a2 to your computer and use it in GitHub Desktop.
add-bindings-and-hosts
#https://bitbucket.org/sitecoreautomationteam/sitecore-automation/wiki/Home
#https://www.powershellgallery.com/packages/sitecore-automation/0.9
Import-Module sitecore-automation -force
# This file must exist
$devhosts = 'C:\Users\user\Desktop\dev.hosts'
# Path to config files
$webPath = 'E:\www\MyProject\Website\App_Config\Include\'
# Gets all configured <sites>
$hosts = Get-SitecoreSites -Path $webPath | Select-Object -ExpandProperty hostName
# Adds bindinds to specified IIS website
Add-SitecoreBindings -Hosts $hosts -WebSite "Sitecore"
foreach($hostName in $hosts)
{
# Adds hosts entries in local hosts file (default C:\WINDOWS\System32\drivers\etc\hosts)
New-SitecoreHostsEntry -IpAddress 127.0.0.1 -HostName $hostName
# Add hosts entires to hosts file used on your local machine
New-SitecoreHostsEntry -IpAddress 10.10.10.10 -HostName $hostName -Path $devhosts
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment