1+ # ############################
2+ # ## Run from Hyper-V Host ###
3+ # ############################
4+
5+ # run from Host to expand C: drives in VMs to 120GB. This is required as Install-AKSHCI checks free space on C (should check free space in CSV)
6+ $VMs = Get-VM - VMName WSLab* azshci*
7+ $VMs | Get-VMHardDiskDrive - ControllerLocation 0 | Resize-VHD - SizeBytes 120 GB
8+ # VM Credentials
9+ $secpasswd = ConvertTo-SecureString " LS1setup!" - AsPlainText - Force
10+ $VMCreds = New-Object System.Management.Automation.PSCredential (" corp\LabAdmin" , $secpasswd )
11+ Foreach ($VM in $VMs ){
12+ Invoke-Command - VMname $vm.name - Credential $VMCreds - ScriptBlock {
13+ $part = Get-Partition - DriveLetter c
14+ $sizemax = ($part | Get-PartitionSupportedSize ).SizeMax
15+ $part | Resize-Partition - Size $sizemax
16+ }
17+ }
18+
19+ # ##################
20+ # ## Run from DC ###
21+ # ##################
22+
123# region Create 2 node cluster (just simple. Not for prod - follow hyperconverged scenario for real clusters https://github.com/microsoft/WSLab/tree/master/Scenarios/S2D%20Hyperconverged)
224# LabConfig
325$Servers = " AzsHCI1" , " AzSHCI2"
@@ -6,8 +28,7 @@ $ClusterName="AzSHCI-Cluster"
628# Install features for management on server
729Install-WindowsFeature - Name RSAT- Clustering, RSAT- Clustering- Mgmt, RSAT- Clustering- PowerShell, RSAT- Hyper- V- Tools
830
9- # Update servers - if you will update, script will fail in install-akshci as it checks for free space. After updates will be free space less than 50GB
10- <#
31+ # Update servers
1132Invoke-Command - ComputerName $servers - ScriptBlock {
1233 # Grab updates
1334 $ScanResult = Invoke-CimMethod - Namespace " root/Microsoft/Windows/WindowsUpdate" - ClassName " MSFT_WUOperations" - MethodName ScanForUpdates - Arguments @ {SearchCriteria = " IsInstalled=0" }
@@ -24,7 +45,6 @@ if ($ServersToReboot){
2445 # failsafe - sometimes it evaluates, that servers completed restart after first restart (hyper-v needs 2)
2546 Start-sleep 20
2647}
27- #>
2848
2949# Install features on servers
3050Invoke-Command - computername $Servers - ScriptBlock {
@@ -64,10 +84,10 @@ Enable-ClusterS2D -CimSession $ClusterName -Verbose -Confirm:0
6484
6585# region Download AKS HCI module
6686$ProgressPreference = ' SilentlyContinue' # for faster download
67- Invoke-WebRequest - Uri " https://aka.ms/aks-hci-download" - UseBasicParsing - OutFile " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-1.0 .zip"
87+ Invoke-WebRequest - Uri " https://aka.ms/aks-hci-download" - UseBasicParsing - OutFile " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-Oct-2020 .zip"
6888$ProgressPreference = ' Continue' # return progress preference back
6989# unzip
70- Expand-Archive - Path " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-1.0 .zip" - DestinationPath " $env: USERPROFILE \Downloads" - Force
90+ Expand-Archive - Path " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-Oct-2020 .zip" - DestinationPath " $env: USERPROFILE \Downloads" - Force
7191Expand-Archive - Path " $env: USERPROFILE \Downloads\AksHci.Powershell.zip" - DestinationPath " $env: USERPROFILE \Downloads\AksHci.Powershell" - Force
7292
7393# endregion
@@ -201,13 +221,16 @@ if (($subscriptions).count -gt 1){
201221$subscriptionID = (Get-AzSubscription ).ID
202222
203223# register Azure Stack HCI
204- # first disable IE ESC
205- $AdminKey = " HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
206- Set-ItemProperty - Path $AdminKey - Name " IsInstalled" - Value 0
207- # register (needs to run 3 times and allow all web pages in IE)...
208- 1 .. 3 | foreach-object {
209- Register-AzStackHCI - SubscriptionID $subscriptionID - ComputerName $ClusterName
210- }
224+ # add some trusted sites (to be able to authenticate with Register-AzStackHCI)
225+ reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\live.com\login" / v https / t REG_DWORD / d 2
226+ reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\microsoftonline.com\login" / v https / t REG_DWORD / d 2
227+ reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\msauth.net\aadcdn" / v https / t REG_DWORD / d 2
228+ reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\msauth.net\logincdn" / v https / t REG_DWORD / d 2
229+ reg add " HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\msftauth.net\aadcdn" / v https / t REG_DWORD / d 2
230+ # and register
231+ Register-AzStackHCI - SubscriptionID $subscriptionID - ComputerName $ClusterName
232+
233+
211234# or more complex
212235<#
213236#grab location
@@ -285,6 +308,10 @@ Get-AzADApplication -DisplayNameStartWith $ClusterName | Remove-AzADApplication
285308# following code is work-in-progress #
286309# #####################################
287310
311+ # #####################
312+ # ## Run from Win10 ###
313+ # #####################
314+
288315# region Windows Admin Center on Win10
289316
290317 # install WAC
@@ -310,25 +337,36 @@ Get-AzADApplication -DisplayNameStartWith $ClusterName | Remove-AzADApplication
310337
311338
312339 # add feed
340+ # download nupgk (included in aks-hci module)
341+ $ProgressPreference = ' SilentlyContinue' # for faster download
342+ Invoke-WebRequest - Uri " https://aka.ms/aks-hci-download" - UseBasicParsing - OutFile " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-Oct-2020.zip"
343+ $ProgressPreference = ' Continue' # return progress preference back
344+ # unzip
345+ Expand-Archive - Path " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-Oct-2020.zip" - DestinationPath " $env: USERPROFILE \Downloads" - Force
346+ Expand-Archive - Path " $env: USERPROFILE \Downloads\AksHci.Powershell.zip" - DestinationPath " $env: USERPROFILE \Downloads\AksHci.Powershell" - Force
313347 $Filename = Get-ChildItem - Path $env: userprofile \downloads\ | Where-Object Name -like " msft.sme.aks.*.nupkg"
314348 New-Item - Path " C:\WACFeeds\" - Name Feeds - ItemType Directory - Force
315349 Copy-Item - Path $FileName.FullName - Destination " C:\WACFeeds\"
316350 Add-Feed - GatewayEndpoint " https://localhost:6516/" - Feed " C:\WACFeeds\"
317351
318- # List Kubernetes extensions
352+ # List Kubernetes extensions (you need to log into WAC in Edge for this command to succeed)
319353 Get-Extension " https://localhost:6516/" | where title -like * kubernetes*
320354
321- # Install Kubernetes Extension (still does not seems to be installed from GUI, bug?)
355+ # Install Kubernetes Extension
322356 $extension = Get-Extension " https://localhost:6516/" | where title -like * kubernetes*
323357 Install-Extension - ExtensionId $extension.id
324358
325359# endregion
326360
361+ # ##################
362+ # ## Run from DC ###
363+ # ##################
364+
327365# region Windows Admin Center on GW
328366
329367# Install Edge
330368$ProgressPreference = ' SilentlyContinue' # for faster download
331- Invoke-WebRequest - Uri " http ://dl.delivery.mp.microsoft.com/filestreamingservice/files/40e309b4-5d46-4AE8-b839-bd74b4cff36e/MicrosoftEdgeEnterpriseX64. msi" - UseBasicParsing - OutFile " $env: USERPROFILE \Downloads\MicrosoftEdgeEnterpriseX64.msi"
369+ Invoke-WebRequest - Uri " https ://aka.ms/edge- msi" - UseBasicParsing - OutFile " $env: USERPROFILE \Downloads\MicrosoftEdgeEnterpriseX64.msi"
332370$ProgressPreference = ' Continue' # return progress preference back
333371# start install
334372Start-Process - Wait - Filepath msiexec.exe - Argumentlist " /i $env: UserProfile \Downloads\MicrosoftEdgeEnterpriseX64.msi /q"
@@ -376,10 +414,10 @@ foreach ($computer in $computers){
376414
377415# Download AKS HCI module
378416$ProgressPreference = ' SilentlyContinue' # for faster download
379- Invoke-WebRequest - Uri " https://aka.ms/aks-hci-download" - UseBasicParsing - OutFile " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-1.0 .zip"
417+ Invoke-WebRequest - Uri " https://aka.ms/aks-hci-download" - UseBasicParsing - OutFile " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-Oct-2020 .zip"
380418$ProgressPreference = ' Continue' # return progress preference back
381419# unzip
382- Expand-Archive - Path " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-1.0 .zip" - DestinationPath " $env: USERPROFILE \Downloads" - Force
420+ Expand-Archive - Path " $env: USERPROFILE \Downloads\AKS-HCI-Public-Preview-Oct-2020 .zip" - DestinationPath " $env: USERPROFILE \Downloads" - Force
383421Expand-Archive - Path " $env: USERPROFILE \Downloads\AksHci.Powershell.zip" - DestinationPath " $env: USERPROFILE \Downloads" - Force
384422
385423# copy nupkg to WAC
0 commit comments