File tree 5 files changed +32
-0
lines changed
02_FullTrustSolutions/Lab
5 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments