Skip to content

Commit

Permalink
Merge pull request #454 from microsoft/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jaromirk authored Aug 25, 2021
2 parents 539cd1c + 1acfcda commit 95a74e1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
12 changes: 8 additions & 4 deletions Scripts/2_CreateParentDisks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1108,11 +1108,15 @@ If (-not $isAdmin) {
#region finishing
WriteSuccess "Script finished at $(Get-date) and took $(((get-date) - $StartDateTime).TotalMinutes) Minutes"

WriteInfoHighlighted "Do you want to cleanup unnecessary files and folders? Deault (Y)"
WriteInfo "`t (.\Temp\ 1_Prereq.ps1 2_CreateParentDisks.ps1 and rename 3_deploy to just deploy)"
If ((Read-host "`t Please type Y or N") -like "*N"){
$options = [System.Management.Automation.Host.ChoiceDescription[]] @(
<# 0 #> New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Cleanup .\Temp\ 1_Prereq.ps1 2_CreateParentDisks.ps1 and rename 3_deploy.ps1 to just deploy.ps1"
<# 1 #> New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Keep files (in case DC was not created sucessfully)"
)
$response = $host.UI.PromptForChoice("Unnecessary files cleanup","Do you want to cleanup unnecessary files and folders?", $options, 0 <#default option#>)

If ($response -eq 1){
$renamed = $false
WriteInfo "`t You typed N, skipping cleanup"
WriteInfo "Skipping cleanup"
}else{
$renamed = $true
WriteInfo "`t `t Cleaning unnecessary items"
Expand Down
8 changes: 5 additions & 3 deletions Scripts/3_Deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,9 @@ If (-not $isAdmin) {
} elseif($LabConfig.AutoStartAfterDeploy -eq "DeployedOnly") {
$startVMs = 2
}


$CheckPointTime=Get-Date

if(-not $LabConfig.ContainsKey("AutoStartAfterDeploy") -and $AllVMs.Count -gt 0) {
$options = [System.Management.Automation.Host.ChoiceDescription[]] @(
<# 0 #> New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No VM will be started."
Expand Down Expand Up @@ -1610,7 +1612,7 @@ If (-not $isAdmin) {
if((Get-TelemetryLevel) -in $TelemetryEnabledLevels) {
WriteInfo "Sending telemetry info"
$metrics = @{
'script.duration' = [Math]::Round(((Get-Date) - $StartDateTime).TotalSeconds, 2)
'script.duration' = [Math]::Round(($CheckPointTime - $StartDateTime).TotalSeconds, 2)
'lab.vmsCount.active' = ($AllVMs | Measure-Object).Count # how many VMs are running
'lab.vmsCount.provisioned' = ($provisionedVMs | Measure-Object).Count # how many VMs were created by this script run
}
Expand All @@ -1626,7 +1628,7 @@ If (-not $isAdmin) {
}

#write how much it took to deploy
WriteInfo "Script finished at $(Get-Date) and took $(((Get-Date) - $StartDateTime).TotalMinutes) Minutes"
WriteInfo "Script finished at $CheckPointTime and took $(($CheckPointTime - $StartDateTime).TotalMinutes) Minutes"

Stop-Transcript

Expand Down
14 changes: 7 additions & 7 deletions Scripts/LabConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'M
#region Same as above, but with more explanation
<#
$LabConfig=@{
DomainAdminName='LabAdmin'; # Used during 2_CreateParentDisks (no affect if changed after this step)
AdminPassword='LS1setup!'; # Used during 2_CreateParentDisks. If changed after, it will break the functionality of 3_Deploy.ps1
Prefix = 'MSLab-'; # (Optional) All VMs and vSwitch are created with this prefix, so you can identify the lab. If not specified, Lab folder name is used
SwitchName = 'LabSwitch'; # (Optional) Name of vSwitch
SwitchNICs = 'NIC1",NIC2" ; # (Optional) Adds these NICs to vSwitch (without connecting hostOS).
DomainAdminName="LabAdmin"; # Used during 2_CreateParentDisks (no affect if changed after this step)
AdminPassword="LS1setup!"; # Used during 2_CreateParentDisks. If changed after, it will break the functionality of 3_Deploy.ps1
Prefix = "MSLab-"; # (Optional) All VMs and vSwitch are created with this prefix, so you can identify the lab. If not specified, Lab folder name is used
SwitchName = "LabSwitch"; # (Optional) Name of vSwitch
SwitchNICs = "NIC1","NIC2"; # (Optional) Adds these NICs to vSwitch (without connecting hostOS).
SecureBoot=$true; # (Optional) Useful when testing unsigned builds (Useful for MS developers for daily builds)
DCEdition='4'; # 4 for DataCenter or 3 for DataCenterCore
InstallSCVMM='No'; # (Optional) Yes/Prereqs/SQL/ADK/No
DCEdition="4"; # 4 for DataCenter or 3 for DataCenterCore
InstallSCVMM="No"; # (Optional) Yes/Prereqs/SQL/ADK/No
AdditionalNetworksInDC=$false; # (Optional) If Additional networks should be added also to DC
DomainNetbiosName="Corp"; # (Optional) If set, custom domain NetBios name will be used. if not specified, Default "corp" will be used
DomainName="Corp.contoso.com"; # (Optional) If set, custom DomainName will be used. If not specified, Default "Corp.contoso.com" will be used
Expand Down

0 comments on commit 95a74e1

Please sign in to comment.