-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwordpress.ps
66 lines (55 loc) · 2.64 KB
/
wordpress.ps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
" - Installing Features"
If ((Get-CimInstance Win32_OperatingSystem).ProductType -eq 1) {
# Windows Client
Enable-WindowsOptionalFeature -FeatureName `
IIS-WebServerRole,IIS-WebServer,IIS-CommonHttpFeatures,IIS-StaticContent, `
IIS-DefaultDocument,IIS-DirectoryBrowsing,IIS-HttpErrors, `
IIS-ApplicationDevelopment,IIS-CGI,IIS-HealthAndDiagnostics, `
IIS-HttpLogging,IIS-LoggingLibraries,IIS-RequestMonitor,IIS-Security, `
IIS-RequestFiltering,IIS-Performance,IIS-HttpCompressionStatic, `
IIS-WebServerManagementTools,IIS-ManagementConsole,IIS-ManagementService, `
WAS-WindowsActivationService,WAS-ProcessModel,WAS-NetFxEnvironment, `
WAS-ConfigurationAPI,NetFx3 -Online -All -Source D:\Sources\sxs | Out-Null
}
Else {
# Windows Server
Install-WindowsFeature `
Web-Server,Web-Common-Http,Web-Static-Content,Web-Default-Doc, `
Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-CGI,Web-Health, `
Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Security, `
Web-Filtering,Web-Performance,Web-Stat-Compression,Web-Mgmt-Tools, `
Web-Mgmt-Service,WAS,WAS-Process-Model,WAS-NET-Environment, `
WAS-Config-APIs,Net-Framework-Core -IncludeManagementTools | Out-Null
}
# Set temporary variables to be used during the WordPress installation
$IIS_PATH = "$env:SystemDrive\inetpub"
$WORDPRESS_PATH = "$IIS_PATH\wordpress"
$WORDPRESS_URL = "https://wordpress.org/latest.zip"
$WORDPRESS_ZIP = "C:\Users\Administrator\Downloads\" + $(Split-Path -Path $WORDPRESS_URL -Leaf)
# Download and install WordPress
"`r`nWordPress ..."
" - Downloading"
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
$webproxy = New-Object System.Net.WebProxy("http://16.85.88.10:8080",$true)
$web = New-Object System.Net.WebClient
$web.Proxy = $webproxy
$web.DownloadFile($WORDPRESS_URL, $WORDPRESS_ZIP)
" - Expanding"
New-Item $WORDPRESS_PATH -ItemType Directory -Force | Out-Null
$ExtractShell = New-Object -ComObject Shell.Application
$Files = $ExtractShell.Namespace($WORDPRESS_ZIP).Items()
$ExtractShell.NameSpace($WORDPRESS_PATH).CopyHere($Files)
# Create a new Internet Information Services application pool for WordPress
" - Creating Application Pool"
$WebAppPool = New-WebAppPool "WordPress"
$WebAppPool.managedPipelineMode = "Classic"
$WebAppPool.managedRuntimeVersion = ""
$WebAppPool | Set-Item
# Create a new Internet Information Services website for WordPress
" - Creating WebSite"
New-Website "WordPress" -ApplicationPool "WordPress" -PhysicalPath "$WORDPRESS_PATH" | Out-Null
# Remove the “Default Web Site” and start the new “WordPress” website
" - Activating WebSite"
Remove-Website "Default Web Site"
Start-Website "WordPress"
"Done."