-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSilent_Installer.ps1
285 lines (261 loc) · 16.2 KB
/
Silent_Installer.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
$host.ui.RawUI.WindowTitle = "Unattended Software Deployment"
[Console]::WindowWidth=102;
[Console]::Windowheight=30;
[Console]::setBufferSize(102,30) #width,height
$Display = {
Write-Host " ____ ___ __ __ .___ .___
| | \____ _____ _/ |__/ |_ ____ ____ __| _/____ __| _/
| | / \\__ \\ __\ __\/ __ \ / \ / __ |/ __ \ / __ |
| | / | \/ __ \| | | | \ ___/| | \/ /_/ \ ___// /_/ |
|______/|___| (____ /__| |__| \___ >___| /\____ |\___ >____ |
\/ \/ \/ \/ \/ \/ \/ " -ForegroundColor Cyan
Write-Host " ________ .__
\______ \ ____ ______ | | ____ ___.__. ___________
| | \_/ __ \\____ \| | / _ < | |/ __ \_ __ \
| | \ ___/| |_> > |_( <_> )___ \ ___/| | \/
/_______ /\___ > __/|____/\____// ____|\___ >__|
@sd-itlab.de \/ \/|__| \/ \/ v5.0.0" -ForegroundColor Red
}
$Firefox = {
Write-Host " ║ " -ForegroundColor Yellow -NoNewline
Write-Host "Installiere Software: " -ForegroundColor Red -NoNewline
Write-Host "Mozilla Firefox... " -ForegroundColor Yellow -NoNewline
if (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -match "Firefox" }) {
Write-Host "| Software ist bereits Installiert " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
if (Test-Path .\Files\Firefox*.exe -PathType Leaf) {
Start-Process -Wait -FilePath .\Files\Firefox*.exe -Argument "-ms -ma" -PassThru | Out-Null
Write-Host "| Erfolgreich! " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
Write-Host "| FEHLER - Datei nicht gefunden. " -ForegroundColor Red -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
}
Start-Sleep 1
}
$Chrome = {
Write-Host " ║ " -ForegroundColor Yellow -NoNewline
Write-Host "Installiere Software: " -ForegroundColor Red -NoNewline
Write-Host "Google Chrome... " -ForegroundColor Yellow -NoNewline
$chromePath = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty '(Default)'
if ($chromePath -ne $null) {
Write-Host "| Software ist bereits Installiert " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
if (Test-Path .\Files\chrome*.exe -PathType Leaf) {
Start-Process -Wait -FilePath .\Files\chrome*.exe -Argument "/silent /install" -PassThru | Out-Null
Write-Host "| Erfolgreich! " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
Write-Host "| FEHLER - Datei nicht gefunden. " -ForegroundColor Red -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
}
Start-Sleep 1
}
$Thunderbird = {
Write-Host " ║ " -ForegroundColor Yellow -NoNewline
Write-Host "Installiere Software: " -ForegroundColor Red -NoNewline
Write-Host "Mozilla Thunderbird... " -ForegroundColor Yellow -NoNewline
if (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -match "Thunderbird" }) {
Write-Host "| Software ist bereits Installiert " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
if (Test-Path .\Files\thunderbird*.exe -PathType Leaf) {
Start-Process -Wait -FilePath .\Files\thunderbird*.exe -Argument "/S /quiet" -PassThru | Out-Null
Write-Host "| Erfolgreich! " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
Write-Host "| FEHLER - Datei nicht gefunden. " -ForegroundColor Red -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
}
Start-Sleep 1
}
$VLC = {
Write-Host " ║ " -ForegroundColor Yellow -NoNewline
Write-Host "Installiere Software: " -ForegroundColor Red -NoNewline
Write-Host "VLC Media Player... " -ForegroundColor Yellow -NoNewline
if (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -match "VLC" }) {
Write-Host "| Software ist bereits Installiert " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
if (Test-Path .\Files\vlc*.exe -PathType Leaf) {
Start-Process -Wait -FilePath .\Files\vlc*.exe -Argument "/S /L=1031" -PassThru | Out-Null
Write-Host "| Erfolgreich! " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
Write-Host "| FEHLER - Datei nicht gefunden. " -ForegroundColor Red -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
}
Start-Sleep 1
}
$AdobeReaderDC = {
Write-Host " ║ " -ForegroundColor Yellow -NoNewline
Write-Host "Installiere Software: " -ForegroundColor Red -NoNewline
Write-Host "Adobe Acrobat Reader DC... " -ForegroundColor Yellow -NoNewline
if(Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -Match "Adobe" }) {
Write-Host "| Software ist bereits Installiert " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
if (Test-Path .\Files\AcroRdrDC*.exe -PathType Leaf) {
Start-Process -Wait -FilePath .\Files\AcroRdrDC*.exe -Argument "/sAll /rs /msi EULA_ACCEPT=YES" -PassThru | Out-Null
Write-Host "| Erfolgreich! " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
Write-Host "| FEHLER - Datei nicht gefunden. " -ForegroundColor Red -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
}
Start-Sleep 1
}
$Java = {
Write-Host " ║ " -ForegroundColor Yellow -NoNewline
Write-Host "Installiere Software: " -ForegroundColor Red -NoNewline
Write-Host "Oracle Java Runtime Environment... " -ForegroundColor Yellow -NoNewline
if(Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.DisplayName -Match "Java" }) {
Write-Host "| Software ist bereits Installiert " -NoNewline -ForegroundColor Green
Write-Host "║" -ForegroundColor Yellow
}
else {
if(Test-Path .\Files\jre*.exe -PathType Leaf) {
Start-Process -Wait -FilePath .\Files\jre*.exe -Argument "/s" -PassThru | Out-Null
Write-Host "| Erfolgreich! " -ForegroundColor Green -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
else {
Write-Host "| FEHLER - Datei nicht gefunden. " -ForegroundColor Red -NoNewline
Write-Host "║" -ForegroundColor Yellow
}
}
Start-Sleep 1
}
$End = {
Write-Host " ║ ║" -ForegroundColor Yellow
Write-Host " ╠═══════════════════════════════════════════════════════════════════════════════════════════════╣" -ForegroundColor Yellow
Write-Host " ║ " -NoNewline -ForegroundColor Yellow
Write-Host "Der Installationsprozess war Erfolgreich!" -NoNewline -ForegroundColor Green
Write-Host " ║" -ForegroundColor Yellow
Write-Host " ╚═══════════════════════════════════════════════════════════════════════════════════════════════╝" -ForegroundColor Yellow
Start-Sleep 5
}
function menu {
Invoke-Command -ScriptBlock $Display
Write-Host " ═════════════╦═══════════════════════════════════════════════════════════════════════╦═════════════" -ForegroundColor Yellow
Write-Host " ╠═════════════════════════════" -NoNewline -ForegroundColor Yellow
Write-Host " Menüliste " -ForegroundColor Cyan -NoNewline
Write-Host "═════════════════════════════╣ " -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Write-Host " ║" -ForegroundColor Yellow -NoNewLine
Write-Host " 1: Unbeaufsichtigte Installation ohne Java " -ForegroundColor Cyan -NoNewLine
Write-Host "║" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Write-Host " ║" -ForegroundColor Yellow -NoNewLine
Write-Host " 2: Unbeaufsichtigte Installation ohne Java und Thunderbird " -ForegroundColor Cyan -NoNewLine
Write-Host "║" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Write-Host " ║" -ForegroundColor Yellow -NoNewLine
Write-Host " 3: Unbeaufsichtigte Installation mit Java " -ForegroundColor Cyan -NoNewLine
Write-Host "║" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Write-Host " ║" -ForegroundColor Yellow -NoNewLine
Write-Host " 4: Unbeaufsichtigte Installation mit Java aber ohne Thunderbird " -ForegroundColor Cyan -NoNewLine
Write-Host "║" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Write-Host " ╠═══════════════════════════════════════════════════════════════════════╣" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Write-Host " ║" -ForegroundColor Yellow -NoNewLine
Write-Host " 0: Beenden 5: Readme " -ForegroundColor Magenta -NoNewLine
Write-Host "║" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Write-Host " ╚═══════════════════════════════════════════════════════════════════════╝" -ForegroundColor Yellow
Write-Host
$actions = "0"
while ($actions -notin "0..5") {
$actions = Read-Host -Prompt ' Was möchten Sie installieren? ( 1 | 2 | 3 | 4 )'
if ($actions -in 0..5) {
if ($actions -eq 0) {
exit
}
if ($actions -eq 1) {
$host.ui.RawUI.WindowTitle = "Unattended Software Deployment without Java"
Clear-Host
Invoke-Command -ScriptBlock $Display
Write-Host "══╦═══════════════════════════════════════════════════════════════════════════════════════════════╦══" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Invoke-Command -ScriptBlock $Firefox
Invoke-Command -ScriptBlock $Chrome
Invoke-Command -ScriptBlock $Thunderbird
Invoke-Command -ScriptBlock $VLC
Invoke-Command -ScriptBlock $AdobeReaderDC
Invoke-Command -ScriptBlock $End
exit
}
if ($actions -eq 2) {
$host.ui.RawUI.WindowTitle = "Unattended Software Deployment without Java and Thunderbird"
Clear-Host
Invoke-Command -ScriptBlock $Display
Write-Host "══╦═══════════════════════════════════════════════════════════════════════════════════════════════╦══" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Invoke-Command -ScriptBlock $Firefox
Invoke-Command -ScriptBlock $Chrome
Invoke-Command -ScriptBlock $VLC
Invoke-Command -ScriptBlock $AdobeReaderDC
Invoke-Command -ScriptBlock $End
exit
}
if ($actions -eq 3) {
$host.ui.RawUI.WindowTitle = "Unattended Software Deployment with Java"
Clear-Host
Invoke-Command -ScriptBlock $Display
Write-Host "══╦═══════════════════════════════════════════════════════════════════════════════════════════════╦══" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Invoke-Command -ScriptBlock $Firefox
Invoke-Command -ScriptBlock $Chrome
Invoke-Command -ScriptBlock $Thunderbird
Invoke-Command -ScriptBlock $VLC
Invoke-Command -ScriptBlock $AdobeReaderDC
Invoke-Command -ScriptBlock $Java
Invoke-Command -ScriptBlock $End
exit
}
if ($actions -eq 4) {
$host.ui.RawUI.WindowTitle = "Unattended Software Deployment with Java but without Thunderbird"
Clear-Host
Invoke-Command -ScriptBlock $Display
Write-Host "══╦═══════════════════════════════════════════════════════════════════════════════════════════════╦══" -ForegroundColor Yellow
Write-Host " ║ ║" -ForegroundColor Yellow
Invoke-Command -ScriptBlock $Firefox
Invoke-Command -ScriptBlock $Chrome
Invoke-Command -ScriptBlock $VLC
Invoke-Command -ScriptBlock $AdobeReaderDC
Invoke-Command -ScriptBlock $Java
Invoke-Command -ScriptBlock $End
exit
}
if ($actions -eq 5) {
Start-Process "https://github.com/SD-ITLab/Silent-Software-Installer-Unattended-Script"
menu
}
exit
menu
}
else {
menu
}
}
}
menu