Skip to content

Commit 87d5b6c

Browse files
committedApr 30, 2016
Labs
1 parent 39128ee commit 87d5b6c

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
2+
3+
$siteDomain = "intranet.wingtip.com"
4+
$siteUrl = "https://$siteDomain"
5+
$siteDisplayName = "Wingtip Intranet"
6+
$siteTemplate = "STS#0"
7+
$siteOwner = "WINGTIP\Administrator"
8+
$hostWebApplication = Get-SPWebApplication "http://wingtipserver"
9+
10+
cls
11+
Write-Host
12+
Write-Host "This script will create the test site collection for $siteDisplayName"
13+
Write-Host
14+
15+
$site = Get-SPSite | Where-Object {$_.Url -eq $siteUrl}
16+
if ($site -ne $null) {
17+
Write-Host "Deleting existing site collection at $siteUrl..." -ForegroundColor Red
18+
Remove-SPSite -Identity $site -Confirm:$false
19+
}
20+
21+
Write-Host "Creating site collection at $siteUrl using New-SPSite..." -ForegroundColor Yellow
22+
$site = New-SPSite -URL $siteUrl -Name $siteDisplayName -Template $siteTemplate -OwnerAlias $siteOwner -HostHeaderWebApplication $hostWebApplication
23+
24+
# add entry to HOST file to fix Visual Studio bug
25+
$hostsFilePath = "c:\Windows\System32\Drivers\etc\hosts"
26+
$hostFileEntry = "127.0.0.1 $siteDomain"
27+
Add-Content -Path $hostsFilePath -Value "`r`n$hostFileEntry"
28+
Write-Host "HOST file entry added: $hostFileEntry" -ForegroundColor Gray
29+
30+
Write-Host "Site collection created at $site.Url" -ForegroundColor Green
31+
Write-Host "Launching site in Internet Explorer..." -ForegroundColor Green
32+
Start iexplore $siteUrl
891 KB
Binary file not shown.
1.05 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.