-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01MAIN.ps1
147 lines (109 loc) · 4.63 KB
/
01MAIN.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Master script
function Wait-ForUserConfirmation {
param (
[string]$Message = "Press Enter to continue..."
)
Write-Host $Message -ForegroundColor Green
Read-Host
}
# Step 1: Create Virtual Machines
Write-Host "Step 1: Creating Virtual Machines..." -ForegroundColor Cyan
# Script 2
# Skapa tre Generation 1 virtuella maskiner och en Windows 10 klient i Hyper-V
# Call the script block or function for creating VMs
.\02CLIENTDCSRV12.ps1
# Define total time (7 minutes in seconds) and intervals
$TotalSeconds = 420
$Intervals = 100
$SleepDuration = $TotalSeconds / $Intervals # Time to sleep per interval
# Create a loading bar using Write-Progress
for ($i = 1; $i -le $Intervals; $i++) {
# Calculate percentage complete
$PercentComplete = ($i / $Intervals) * 100
# Display the loading bar
Write-Progress -Activity "Processing..." `
-Status "Please wait, completing task..." `
-PercentComplete $PercentComplete
# Sleep for the duration of one interval
Start-Sleep -Seconds $SleepDuration
}
# Final message
Write-Host "Loading complete!" -ForegroundColor Green
Write-Host "Step 1 completed: Virtual Machines created." -ForegroundColor Green
Wait-ForUserConfirmation "Virtual Machines are created. Press Enter to proceed to Step 2..."
# Step 2: Configure Static IPs and Rename Computers
Write-Host "Step 2: Configuring Static IPs and Renaming Computers..." -ForegroundColor Cyan
# Script 3
.\03IPNAMECONF.ps1
# Define total time (1 minutes in seconds) and intervals
$TotalSeconds = 60
$Intervals = 100
$SleepDuration = $TotalSeconds / $Intervals # Time to sleep per interval
# Create a loading bar using Write-Progress
for ($i = 1; $i -le $Intervals; $i++) {
# Calculate percentage complete
$PercentComplete = ($i / $Intervals) * 100
# Display the loading bar
Write-Progress -Activity "Processing..." `
-Status "Please wait, completing task..." `
-PercentComplete $PercentComplete
# Sleep for the duration of one interval
Start-Sleep -Seconds $SleepDuration
}
# Final message
Write-Host "Loading complete!" -ForegroundColor Green
Write-Host "Step 2 completed: IPs configured and computers renamed." -ForegroundColor Green
Wait-ForUserConfirmation "IPs and computer names are configured. Press Enter to proceed to Step 3..."
# Step 3: Promote DC1 to Domain Controller
Write-Host "Step 3: Promoting DC1 to Domain Controller..." -ForegroundColor Cyan
# Script 4
# Call the script block or function for domain controller promotion
.\04PROMOTEDC.ps1
# Define total time (11 minutes in seconds) and intervals
$TotalSeconds = 480
$Intervals = 100
$SleepDuration = $TotalSeconds / $Intervals # Time to sleep per interval
# Create a loading bar using Write-Progress
for ($i = 1; $i -le $Intervals; $i++) {
# Calculate percentage complete
$PercentComplete = ($i / $Intervals) * 100
# Display the loading bar
Write-Progress -Activity "Processing..." `
-Status "Please wait, completing task..." `
-PercentComplete $PercentComplete
# Sleep for the duration of one interval
Start-Sleep -Seconds $SleepDuration
}
# Final message
Write-Host "Loading complete!" -ForegroundColor Green
Write-Host "Step 3 completed: DC1 promoted to Domain Controller." -ForegroundColor Green
Wait-ForUserConfirmation "DC1 is now a Domain Controller. Press Enter to proceed to Step 4..."
# Step 4: Join Computers to the Domain
Write-Host "Step 4: Joining Computers to the Domain..." -ForegroundColor Cyan
# Script 5
# Call the script block or function for domain join
.\05JOINDOMAIN.ps1
# Define total time (1 minutes in seconds) and intervals
$TotalSeconds = 60
$Intervals = 100
$SleepDuration = $TotalSeconds / $Intervals # Time to sleep per interval
# Create a loading bar using Write-Progress
for ($i = 1; $i -le $Intervals; $i++) {
# Calculate percentage complete
$PercentComplete = ($i / $Intervals) * 100
# Display the loading bar
Write-Progress -Activity "Processing..." `
-Status "Please wait, completing task..." `
-PercentComplete $PercentComplete
# Sleep for the duration of one interval
Start-Sleep -Seconds $SleepDuration
}
Write-Host "Step 4 completed: All computers joined to the domain." -ForegroundColor Green
Wait-ForUserConfirmation "Computers have joined the domain. Press Enter to proceed to Step 4..."
# Script 6
# Create OUs and Users
.\06CREATEOUANDUSERS.ps1
.\07SHARE.ps1
.\08WEBSERVER.ps1
Write-Host "Step 5 completed: OU and users where created." -ForegroundColor Green
Write-Host "All steps completed successfully!" -ForegroundColor Green