-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.ps1
104 lines (89 loc) · 3.15 KB
/
config.ps1
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Configuration build {
Import-DscResource -Module xPendingReboot, ComputerManagementDsc, xWebAdministration, PSDesiredStateConfiguration
Node $AllNodes.NodeName {
LocalConfigurationManager {
RebootNodeIfNeeded = $true
}
script SSL {
GetScript = {
Get-ChildItem cert:\LocalMachine\My | Where-Object {
$_.Subject -match "flawless\.com"
}
}
SetScript = {
Import-Module PKI
New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -DnsName "flawless.com"
}
TestScript = {
$Cert = Get-ChildItem cert:\LocalMachine\My | Where-Object {
$_.Subject -match "flawless\.com"
}
$Cert.Count -gt 0
}
}
xPendingReboot checkReboot {
name = "flawless reboots plz"
}
Computer SetName {
Name = $node.MachineName
}
WindowsFeature 'windows-internal-database' {
Ensure = 'present'
Name = 'Windows-Internal-Database'
}
WindowsFeature 'microsoftwindowspowershellv2root' {
Ensure = 'absent'
Name = 'MicrosoftWindowsPowerShellV2Root'
}
WindowsFeature 'rsat-nlb' {
Ensure = 'present'
Name = 'RSAT-NLB'
}
WindowsFeature 'nlb' {
Ensure = 'present'
Name = 'NLB'
}
WindowsEventLog ApplicationEventlogSize {
LogName = 'Application'
IsEnabled = $true
LogMode = 'Retain'
MaximumSizeInBytes = 4294967296KB
}
xWebSiteDefaults WebServer {
Applyto = 'Machine'
Logformat = 'IIS'
LogDirectory = 'C:\inetpub\logs\LogFiles'
TraceLogDirectory = 'c:\inetpub\logs\logfiles'
DefaultApplicationPool = 'DefaultAppPool'
AllowSubDirConfig = 'true'
}
xWebsite FlawlessdotCom {
Name = $node.websiteName
PhysicalPath = 'c:\inetpub\flawlessdotcom'
State = 'started'
BindingInfo = @(
MSFT_xWebBindingInformation {
Protocol = "HTTPS"
Port = 443
CertificateSubject = $node.CertSubject
CertificateStoreName = "MY"
}
)
ApplicationPool = 'DefaultAppPool'
Ensure = 'Present'
}
}
}
$ConfigData = @{
AllNodes = @(
@{
NodeName = 'localhost'
MachineName = 'is01'
websiteName = 'flawlessfaction'
CertSubject = 'CN=flawless.com'
}
)
}
build -ConfigurationData $ConfigData
Set-DscLocalConfigurationManager -path .\build -Credential $startCred -ComputerName localhost -Verbose
Start-DscConfiguration -Wait -Path .\build -Credential $startCred -Verbose -Force -ComputerName localhost