Archive for the ‘Webfarm’ Category

Change IIS 7.5 Website ID

If you are building a Webfarm just make sure Your Website ID is the same on your farm.

To change the ID just run the APPCMD

the Sample below I have 3 websites that I want to change the ID

Just change the Web01 with your website and ID I Change the Web01 form ID 40 to 10

appcmd set site Web01 /id:40
appcmd set site Web02 /id:50
appcmd set site Web03 /id:60
appcmd set site Web01 /id:10
appcmd set site Web02 /id:20
appcmd set site Web03 /id:30

Create IIS NLB Copy Full Website Resource Windows 2008R2 With Powershell

If you are Building a Webfarm you need often Test websites and all the Sites needs to be the same Winking smile

Well below is a powershell Scripts that copy the Site and Creates a new one On the Same Server.

 

# NAME: Copy-Website.ps1
#
# AUTHOR: Robert Smit
# EMAIL: robert.smit@aca-computers.nl
#
# COMMENT: Script to create a Copy-Website.
#   
# You have a royalty-free right to use, modify, reproduce, and
# distribute this script file in any way you find useful, provided that
# you agree that the creator, owner above has no warranty, obligations,
# or liability for such use.
#
# VERSION HISTORY:
# 1.0 4.06.2011 – Initial release
#
###########################################################################
ImportSystemModules
#Importing Microsofts PowerShell-modules

#Set ExecutionPolicy
#Set-ExecutionPolicy -scope LocalMachine RemoteSigned –force

#Importing Microsofts PowerShell-module for administering IIS
Import-Module WebAdministration

#List website
Write-Host "List IIS Website…" -ForegroundColor yellow
get-Item IIS:\Sites\*

#Variables for creating the new Website
#
#
$sourceweb = Read-Host "Enter the Website to Copy"
$destinationweb = Read-Host "Enter the New Websitename"
$ChangedDemoSiteBinding = Read-Host "Enter the Hostheader of the website"
$LogDir = Read-Host "Enter the website path of the new website"

#Copy website
Write-Host "copy IIS Website…" -ForegroundColor yellow
copy-Item IIS:\Sites\$sourceweb -destination IIS:\Sites\$destinationweb

#Create Application pool
Write-Host "Create Application pool…" -ForegroundColor yellow
New-WebAppPool $destinationweb

#Link Application pool
Write-Host "Link Application pool…" -ForegroundColor yellow
get-ItemProperty IIS:\Sites\$destinationweb
Set-ItemProperty IIS:\Sites\$destinationweb -name applicationPool -value "$destinationweb"

#Set nieuwe Host name
Write-Host "Set nieuwe Host name…" -ForegroundColor yellow
get-Item IIS:\Sites\$destinationweb
Set-ItemProperty IIS:\Sites\$destinationweb -Name bindings -Value @{protocol="http";bindingInformation="192.168.123.1:80:$ChangedDemoSiteBinding"} #change the IP here

#Set new Path
Write-Host "Set new Path…" -ForegroundColor yellow
get-Item IIS:\Sites\$destinationweb
Set-ItemProperty IIS:\Sites\$destinationweb -Name physicalPath -Value "$LogDir"

#Scopy site
#Write-Host "Scopy site …" -ForegroundColor yellow
#Copy-Item "C:\Put your folder here\*" $LogDir # change The Filepath here

#Set user account
Write-Host "Set user account…" -ForegroundColor yellow
Set-ItemProperty IIS:\Sites\$destinationweb -Name Username -Value "Username"
Set-ItemProperty IIS:\Sites\$destinationweb -Name Password -Value "Password"

Change IIS 7.5 Website ID

If you are building a Webfarm just make sure Your Website ID is the same on your farm.

To change the ID just run the APPCMD

the Sample below I have 3 websites that I want to change the ID

Just change the Web01 with your website and ID I Change the Web01 form ID 40 to 10

appcmd set site Web01 /id:40
appcmd set site Web02 /id:50
appcmd set site Web03 /id:60
appcmd set site Web01 /id:10
appcmd set site Web02 /id:20
appcmd set site Web03 /id:30

Posted June 27, 2011 by Robert Smit in Web Servers, Webfarm, Windows 2008 NLB

Tagged with

  • Tag