Skip to content

Commit 14a006b

Browse files
committed
prompt for input+time counter changed
1 parent d810944 commit 14a006b

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

Scripts/2_CreateParentDisks.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,11 +1108,15 @@ If (-not $isAdmin) {
11081108
#region finishing
11091109
WriteSuccess "Script finished at $(Get-date) and took $(((get-date) - $StartDateTime).TotalMinutes) Minutes"
11101110

1111-
WriteInfoHighlighted "Do you want to cleanup unnecessary files and folders? Deault (Y)"
1112-
WriteInfo "`t (.\Temp\ 1_Prereq.ps1 2_CreateParentDisks.ps1 and rename 3_deploy to just deploy)"
1113-
If ((Read-host "`t Please type Y or N") -like "*N"){
1111+
$options = [System.Management.Automation.Host.ChoiceDescription[]] @(
1112+
<# 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"
1113+
<# 1 #> New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Keep files (in case DC was not created sucessfully)"
1114+
)
1115+
$response = $host.UI.PromptForChoice("Unnecessary files cleanup","Do you want to cleanup unnecessary files and folders?", $options, 0 <#default option#>)
1116+
1117+
If ($response -eq 1){
11141118
$renamed = $false
1115-
WriteInfo "`t You typed N, skipping cleanup"
1119+
WriteInfo "Skipping cleanup"
11161120
}else{
11171121
$renamed = $true
11181122
WriteInfo "`t `t Cleaning unnecessary items"

Scripts/3_Deploy.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,9 @@ If (-not $isAdmin) {
15751575
} elseif($LabConfig.AutoStartAfterDeploy -eq "DeployedOnly") {
15761576
$startVMs = 2
15771577
}
1578-
1578+
1579+
$CheckPointTime=Get-Date
1580+
15791581
if(-not $LabConfig.ContainsKey("AutoStartAfterDeploy") -and $AllVMs.Count -gt 0) {
15801582
$options = [System.Management.Automation.Host.ChoiceDescription[]] @(
15811583
<# 0 #> New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No VM will be started."
@@ -1610,7 +1612,7 @@ If (-not $isAdmin) {
16101612
if((Get-TelemetryLevel) -in $TelemetryEnabledLevels) {
16111613
WriteInfo "Sending telemetry info"
16121614
$metrics = @{
1613-
'script.duration' = [Math]::Round(((Get-Date) - $StartDateTime).TotalSeconds, 2)
1615+
'script.duration' = [Math]::Round(($CheckPointTime - $StartDateTime).TotalSeconds, 2)
16141616
'lab.vmsCount.active' = ($AllVMs | Measure-Object).Count # how many VMs are running
16151617
'lab.vmsCount.provisioned' = ($provisionedVMs | Measure-Object).Count # how many VMs were created by this script run
16161618
}
@@ -1626,7 +1628,7 @@ If (-not $isAdmin) {
16261628
}
16271629

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

16311633
Stop-Transcript
16321634

0 commit comments

Comments
 (0)