Skip to content

Commit 3288788

Browse files
author
Jaromir Kaspar
committed
Dev Merge
1 parent 751fe5c commit 3288788

39 files changed

+3625
-0
lines changed
27 KB
Loading

Docs/Screenshots/Cleanup01.png

36.3 KB
Loading

Docs/Screenshots/Cleanup02.png

25.3 KB
Loading
25 KB
Loading
62.5 KB
Loading
86.3 KB
Loading

Docs/Screenshots/Defender_On.png

4.84 KB
Loading

Docs/Screenshots/Deploy01.png

34 KB
Loading

Docs/Screenshots/Deploy02.png

102 KB
Loading

Docs/Screenshots/Deploy03.png

21 KB
Loading

Docs/Screenshots/FCConsole01.png

60 KB
Loading

Docs/Screenshots/FCConsole02.png

30.8 KB
Loading

Docs/Screenshots/FCConsole03.png

20.8 KB
Loading

Docs/Screenshots/HVConsole01.png

19.8 KB
Loading

Docs/Screenshots/Prereq01.png

19.8 KB
Loading

Docs/Screenshots/Prereq02.png

77 KB
Loading

Docs/Screenshots/Prereq03.png

27.5 KB
Loading

Docs/Screenshots/Prereq04.png

8.64 KB
Loading

Docs/Screenshots/Prereq05.png

7.04 KB
Loading

Docs/Screenshots/Prereq06.png

10.6 KB
Loading

Docs/Screenshots/ServerManager01.png

66.5 KB
Loading

Docs/Screenshots/Variables01.png

30.3 KB
Loading

Docs/Screenshots/Variables02.png

48.2 KB
Loading

Docs/Screenshots/dhcp01.png

23.1 KB
Loading
697 KB
Loading

License

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Microsoft
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#Project Description
2+
Deployment Automation of Windows Server 2016 labs on WS2016/Windows10 Hyper-V
3+
4+
Simply deploy your lab just with these scripts and ISO file.
5+
6+
This solution is used in Microsoft Premier Workshop for Software Defined Storage.
7+
8+
Check [this](https://github.com/Microsoft/ws2016lab/tree/master/Scenarios) page for end to end scenarios!
9+
10+
You can try [dev branch scripts](https://github.com/Microsoft/ws2016lab/blob/dev/scripts.zip) to test new labconfig, vTPM, new nested virtualization, number of Management adapters...
11+
12+
13+
#Usage (more info in [wiki](https://github.com/Microsoft/ws2016lab/wiki) )
14+
15+
**Step 1** Download required files (prerequisities):
16+
* [Scripts](https://github.com/Microsoft/ws2016lab/raw/2016TP5/scripts.zip) (recommended for TP5) or [RTM Scripts](https://github.com/Microsoft/ws2016lab/blob/master/scripts.zip?raw=true) (recommended for RTM)
17+
* [Windows Server 2016](https://www.microsoft.com/en-us/evalcenter/)
18+
* [Latest Cumulative Update](http://catalog.update.microsoft.com/v7/site/Search.aspx?q=Cumulative%20Update%20for%20Windows%20Server%202016%20for%20x64-based%20Systems%20) for Windows Server 2016
19+
20+
**Step 2** Create folder and Unzip scripts there
21+
22+
**Step 3** Right-click and run with PowerShell 1_Prereq.ps1
23+
* 1_Prereq.ps1 will create folder structure and download neccessary files from internet
24+
* If you don't have an internet connection on your server, run this on internet connected machine, copy created files over and run 1_prereq.ps1 again
25+
26+
**Step 4** Copy Cumulative Update into the OSServer\Packages folder.
27+
28+
**Step 5** Right-click and run with PowerShell 2_CreateParentDisks.ps1
29+
* 2_CreateParentDisks.ps1 will check if you have Hyper-V installed, it will prompt you for Windows Server 2016 ISO file, hydrate parent disks and hydrate Domain Controller.
30+
31+
**Step 6** Right-click and run with PowerShell 3_Deploy.ps1
32+
* 3_Deploy.ps1 will deploy S2D Hyperconverged [scenario](https://github.com/Microsoft/ws2016lab/tree/master/Scenarios) defined in Labconfig.ps1 [different examples](https://github.com/Microsoft/ws2016lab/wiki/variables.ps1-examples)
33+
34+
**Step 7** Continue with [S2D Hyperconverged Scenario](https://github.com/Microsoft/ws2016lab/tree/master/Scenarios/S2D%20Hyperconverged)
35+
36+
* This scenario will help you understand new Windows Server 2016 feature called Storage Spaces Direct.
37+
38+
* It will deploy 4 nanoservers simulating 200TB Storage
39+
40+
**Step 8** Cleanup lab with Cleanup.ps1
41+
42+
**Step 9** Try different scenarios
43+
* [Local Admin Password solution for NanoServer](https://github.com/Microsoft/ws2016lab/tree/master/Scenarios/LAPS%20on%20Nano)
44+
* [Testing Nano first boot performance](https://github.com/Microsoft/ws2016lab/tree/master/Scenarios/Testing%20Nano%20performance)
45+
46+
#What's in the lab
47+
48+
Automatically hydrated Domain Controller with DHCP and one scope. There are several accounts automatically provisioned - SQL Run As Account, SQL Agent Account, VMM Service Account and one additional Domain Admin with name you can specify, so you can install SQL + SC VMM easily.
49+
50+
![](https://github.com/Microsoft/ws2016lab/blob/master/Docs/Screenshots/dhcp01.png)
51+
![](https://github.com/Microsoft/ws2016lab/blob/master/Docs/Screenshots/ActiveDirectory01.PNG)
52+
53+
You can then modify LabConfig.ps1 to hydrate whatever you want. Like this 4 node nano s2d cluster with 200TB capacity - all running on ultrabook.
54+
55+
![](https://github.com/Microsoft/ws2016lab/blob/master/Docs/Screenshots/HVConsole01.png)
56+
![](https://github.com/Microsoft/ws2016lab/blob/master/Docs/Screenshots/ServerManager01.png)
57+
![](https://github.com/Microsoft/ws2016lab/blob/master/Docs/Screenshots/FCConsole01.png)
58+
![](https://github.com/Microsoft/ws2016lab/blob/master/Docs/Screenshots/FCConsole02.png)
59+
![](https://github.com/Microsoft/ws2016lab/blob/master/Docs/Screenshots/FCConsole03.png)
60+
61+
#So what is it good for?
62+
63+
Simulations such as
64+
* how to script against nano servers
65+
* how to automate configuration
66+
* what will happen when I run this and that command
67+
* how change drive in S2D cluster
68+
* what will happen when one node goes down
69+
* testing new features before pushing to production
70+
* ...

Scenarios/LAPS on Nano/LAPS.zip

257 KB
Binary file not shown.

Scenarios/LAPS on Nano/readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
See this blogpost for more info https://blogs.msdn.microsoft.com/laps/2016/06/10/testing-laps-for-nano-server-with-ws2016lab/
2+
3+
In zip file you will find mof files and packed module you can just copy into DSC service folder in DC

Scenarios/LAPS on Nano/scripts.ps1

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#$Labconfig.VMs
2+
3+
1..2 | % {Nano$_} | % { $LABConfig.VMs += @{ VMName = $_ ; Configuration = Simple; ParentVHD = Win2016Nano_G2.vhdx; MemoryStartupBytes= 128MB ; DSCMode=Pull; DSCConfig=@(LAPS_Nano_Install,LAPSConfig1)} }
4+
3..4 | % {Nano$_} | % { $LABConfig.VMs += @{ VMName = $_ ; Configuration = Simple; ParentVHD = Win2016Nano_G2.vhdx; MemoryStartupBytes= 128MB ; DSCMode=Pull; DSCConfig=@(LAPS_Nano_Install,LAPSConfig2)} }
5+
6+
7+
#starting VMs one by one (bug in LCM DB)
8+
9+
1..4 | %
10+
    Start-VM *Nano$_ 
11+
    Start-Sleep 30
12+
}
13+
14+
#How to validate report
15+
16+
function GetReport
17+
{
18+
param($AgentId, $serviceURL)
19+
$requestUri = "$serviceURL/Nodes(AgentId= '$AgentId')/Reports"
20+
$request = Invoke-WebRequest -Uri $requestUri -ContentType "application/json;odata=minimalmetadata;streaming=true;charset=utf-8" `
21+
-UseBasicParsing -Headers @{Accept = "application/json";ProtocolVersion = "2.0"} `
22+
-ErrorAction SilentlyContinue -ErrorVariable ev
23+
$object = ConvertFrom-Json $request.content
24+
return $object.value
25+
}
26+
27+
1..4 | ForEach-Object {$servers=$servers+@("Nano$_")}
28+
$Servers | % {GetReport -AgentId (Get-DscLocalConfigurationManager -CimSession $_).AgentId -serviceURL (Get-DscLocalConfigurationManager -CimSession $_).ConfigurationDownloadManagers.serverurl}
+200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Scenario Description
2+
3+
* In this scenario 4 node S2D cluster can be created.
4+
* It is just simulation "how it would look like". Performance is not a subject here.
5+
* It is just to test look and feel
6+
7+
8+
# Scenario requirements
9+
10+
* Windows 10 1511 with enabled Hyper-V or Windows 10 1607 (if nested virtualization is enabled)
11+
* 8GB Memory or 20GB if nested virtualization is used (for 4 node configuration)
12+
* SSD (with HDD it is really slow)
13+
14+
# Labconfig.ps1
15+
16+
17+
* Without Nested Virtualization
18+
````PowerShell
19+
$LabConfig=@{
20+
DomainAdminName='Claus';
21+
AdminPassword='LS1setup!';
22+
Prefix = 'S2DHyperConverged-';
23+
SwitchName = 'LabSwitch';
24+
DCEdition='ServerDataCenter';
25+
VMs=@()
26+
}
27+
28+
1..4 | % {
29+
$VMNames="S2D";
30+
$LABConfig.VMs += @{
31+
VMName = "$VMNames$_" ;
32+
Configuration = 'S2D' ;
33+
ParentVHD = 'Win2016NanoHV_G2.vhdx';
34+
SSDNumber = 0;
35+
SSDSize=800GB ;
36+
HDDNumber = 12;
37+
HDDSize= 4TB ;
38+
MemoryStartupBytes= 512MB
39+
}
40+
}
41+
````
42+
43+
* With Nested Virtualization
44+
````PowerShell
45+
$LabConfig=@{
46+
DomainAdminName='Claus';
47+
AdminPassword='LS1setup!';
48+
Prefix = 'S2DHyperConverged-';
49+
SwitchName = 'LabSwitch';
50+
DCEdition='ServerDataCenter';
51+
VMs=@()
52+
}
53+
54+
1..4 | % {
55+
$VMNames="S2D";
56+
$LABConfig.VMs += @{
57+
VMName = "$VMNames$_" ;
58+
Configuration = 'S2D' ;
59+
ParentVHD = 'Win2016NanoHV_G2.vhdx';
60+
SSDNumber = 0;
61+
SSDSize=800GB ;
62+
HDDNumber = 12;
63+
HDDSize= 4TB ;
64+
MemoryStartupBytes= 4GB;
65+
NestedVirt=$True
66+
}
67+
}
68+
````
69+
70+
# Configuration Script
71+
This script needs to run in DC
72+
73+
* This part sets some variables. For example how many nodes you want to provision or how many disks you want to create
74+
````PowerShell
75+
# 3,4,8, or 16 nodes
76+
$numberofnodes=4
77+
78+
#servernames
79+
1..$numberofnodes | ForEach-Object {$servers=$servers+@("S2D$_")}
80+
81+
#Cluster Name
82+
$ClusterName="S2D-Cluster"
83+
84+
#?Networking
85+
$Networking='Yes'
86+
87+
#Number of MultiResiliencyDisks Created
88+
$MRTNumber=$numberofnodes
89+
````
90+
91+
* This part will install required roles for DC to manage features
92+
````PowerShell
93+
#install features for management
94+
Install-WindowsFeature -Name RSAT-Clustering,RSAT-Clustering-Mgmt,RSAT-Clustering-PowerShell,RSAT-Storage-Replica,RSAT-Hyper-V-Tools
95+
````
96+
97+
* If you want to run Core servers, then you will need to enable hyper-v and another roles. Skip if you have NanoServers
98+
````PowerShell
99+
Invoke-Command -ComputerName $servers -ScriptBlock {Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V -Online -NoRestart}
100+
foreach ($server in $servers) {Install-WindowsFeature -Name Failover-Clustering,Failover-Clustering-S2D,Hyper-V-PowerShell -ComputerName $server}
101+
102+
#restart and wait for computers
103+
Invoke-Command -ComputerName $servers -ScriptBlock {Restart-Computer -Force}
104+
Start-Sleep 60
105+
````
106+
107+
* In this part networking is configured. Just to see how SET Switch looks like and how it looks like when you have 2 vNICS. In real world scenario you would have the same for iWARP, except vNICs should be configured as vRDMA NICs
108+
````PowerShell
109+
if ($Networking -eq "Yes"){
110+
Invoke-Command -ComputerName $servers -ScriptBlock {New-VMSwitch -Name SETSwitch -EnableEmbeddedTeaming $TRUE -MinimumBandwidthMode Weight -NetAdapterName (Get-NetIPAddress -IPAddress 10.* ).InterfaceAlias}
111+
$Servers | ForEach-Object {
112+
Rename-VMNetworkAdapter -ManagementOS -Name SETSwitch -NewName Management1 -ComputerName $_
113+
Add-VMNetworkAdapter -ManagementOS -Name Management2 -SwitchName SETSwitch -ComputerName $_
114+
}
115+
Start-Sleep 5
116+
Clear-DnsClientCache
117+
}
118+
````
119+
120+
* Test and Create new cluster. ClearDNSCLientCace is the same as ipconfig /flushdns. Its needed to know about new cluster dns record.
121+
122+
````PowerShell
123+
Test-Cluster –Node $servers –Include “Storage Spaces Direct”,Inventory,Network,”System Configuration”
124+
New-Cluster –Name $ClusterName –Node $servers
125+
Start-Sleep 5
126+
Clear-DnsClientCache
127+
````
128+
129+
* Enable S2D. It is specific to TP5 as you need to skip automatic configuration and skip eligibility checks (because all disks report with mediatype unknown, therefore eligibility check would fail)
130+
131+
```PowerShell
132+
Enable-ClusterS2D -CimSession $ClusterName -AutoConfig:0
133+
````
134+
135+
* To work with remote storage subsystem from DC, it is useful to register it with this command. I'm using $ClusterName, so I'll always work with some node that's online.
136+
```PowerShell
137+
Get-StorageProvider | Register-StorageSubsystem -ComputerName $ClusterName
138+
````
139+
140+
* Display what was configured with Enable-Clusters2D
141+
```PowerShell
142+
#display pool
143+
$pool=Get-StoragePool *$Clustername
144+
$pool
145+
146+
#Display disks
147+
Get-StoragePool *$Clustername | Get-PhysicalDisk
148+
149+
#display tiers (notice only capacity is available and is )
150+
Get-StorageTier
151+
````
152+
153+
* Create virtual disks.
154+
155+
```PowerShell
156+
if ($numberofnodes -le 3){
157+
1..$MRTNumber | ForEach-Object {
158+
New-Volume -StoragePoolFriendlyName $pool.FriendlyName -FriendlyName MultiResiliencyDisk$_ -FileSystem CSVFS_ReFS -StorageTierFriendlyNames Capacity -StorageTierSizes 2TB
159+
}
160+
}else{
161+
1..$MRTNumber | ForEach-Object {
162+
New-Volume -StoragePoolFriendlyName $pool.FriendlyName -FriendlyName MultiResiliencyDisk$_ -FileSystem CSVFS_ReFS -StorageTierFriendlyNames performance,capacity -StorageTierSizes 1TB,9TB
163+
}
164+
}
165+
start-sleep 10
166+
````
167+
168+
* Rename all CSVs to match virtual disks names
169+
```PowerShell
170+
Get-ClusterSharedVolume -Cluster $ClusterName | % {
171+
$volumepath=$_.sharedvolumeinfo.friendlyvolumename
172+
$newname=$_.name.Substring(22,$_.name.Length-23)
173+
Invoke-Command -ComputerName (Get-ClusterSharedVolume -Cluster $ClusterName -Name $_.Name).ownernode -ScriptBlock {param($volumepath,$newname); Rename-Item -Path $volumepath -NewName $newname} -ArgumentList $volumepath,$newname -ErrorAction SilentlyContinue
174+
}
175+
````
176+
177+
* Configure Quorum (File Share Witness)
178+
179+
```PowerShell
180+
###Configure quorum###
181+
#ConfigureWitness
182+
#Create new directory
183+
$WitnessName=$Clustername+"Witness"
184+
Invoke-Command -ComputerName DC -ScriptBlock {param($WitnessName);new-item -Path c:\Shares -Name $WitnessName -ItemType Directory} -ArgumentList $WitnessName
185+
$accounts=@()
186+
$Servers | % {$accounts+="corp\$_$"}
187+
$accounts+="corp\$ClusterName$"
188+
$accounts+="corp\Domain Admins"
189+
New-SmbShare -Name $WitnessName -Path "c:\Shares\$WitnessName" -FullAccess $accounts -CimSession DC
190+
# Set NTFS permissions
191+
Invoke-Command -ComputerName DC -ScriptBlock {param($WitnessName);(Get-SmbShare "$WitnessName").PresetPathAcl | Set-Acl} -ArgumentList $WitnessName
192+
#Set Quorum
193+
Set-ClusterQuorum -Cluster $ClusterName -FileShareWitness "\\DC\$WitnessName"
194+
195+
````
196+
197+
# How it looks like end-to-end (when you just paste the script).
198+
Note, there are small differences (we did not configure fault domains, but it is displayed on GIF as I did it a while ago.
199+
200+
![](https://github.com/Microsoft/ws2016lab/blob/master/Docs/Screenshots/s2d_Hyperconverged.gif)

0 commit comments

Comments
 (0)