-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Install-Programs.ps1
847 lines (689 loc) · 21.9 KB
/
Install-Programs.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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
<#
.SYNOPSIS
Automates the installation of applications, development tools, and other utilities.
Usage:
.\Install-Programs.ps1 -Base
.PARAMETER Command
Invoke a single command from this script; default is to run all.
.PARAMETER Developer
Installs development tools specific to my needs.
.PARAMETER Extras
Installs extra apps and utilities.
.PARAMETER ListCommands
Show a list of all available commands.
.DESCRIPTION
Highly recommed that you first run all Windows updates and then run
Initialize-Machine.ps1 before running this script.
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param (
[string] $command,
[switch] $ListCommands,
[switch] $Developer,
[switch] $Extras,
[switch] $Continuation
)
Begin
{
. $PSScriptRoot\common.ps1
$script:tools = 'C:\tools'
$script:reminders = @(@())
#==============================================================================================
# BASE
function InstallDotNetRuntime
{
[System.ComponentModel.Description('Install .NET 6 runtime')]
[CmdletBinding(HelpURI = 'cmd')] param()
if (((Get-Command dotnet -ErrorAction:SilentlyContinue) -eq $null) -or `
((dotnet --list-runtimes | where { $_ -match '6\.0\.' }).Count -eq 0))
{
HighTitle '.NET 6.0 Runtime'
choco install -y dotnet
# patch Process path until shell is restarted
$env:PATH = (($env:PATH -split ';') -join ';') + ";C:\Program Files\dotnet"
}
else
{
WriteOK '.NET 6.0 Runtime already installed'
}
}
function InstallNetFx3
{
[System.ComponentModel.Description('Install .NET 3.5 Framework')]
[CmdletBinding(HelpURI = 'cmd')] param()
# installState 1=enabled, 2=disabled, 3=absent, 4=unknown
if ((Get-CimInstance Win32_OptionalFeature | `
where { $_.Name -eq 'NetFx3' -and $_.InstallState -eq 1 }) -eq $null)
{
HighTitle 'NetFx3 (please wait)'
# install .NET 3.5 without causing a reboot
dism /online /norestart /enable-feature /featurename:"NetFx3"
}
else
{
WriteOK 'NetFx3 already installed'
}
}
function InstallNetFx4
{
[System.ComponentModel.Description('Install .NET 4.8 Framework')]
[CmdletBinding(HelpURI = 'cmd')] param()
# .NET Framework is required by many apps
if ((Get-WindowsOptionalFeature -Online -FeatureName 'NetFx4' | `
where { $_.State -eq 'Enabled'}).Count -eq 0)
{
HighTitle '.NET Framework NetFx4'
# don't restart but will after .NET (Core) is installed
Enable-WindowsOptionalFeature -Online -FeatureName 'NetFx4' -NoRestart
RebootWithContinuation
}
else
{
WriteOK '.NET Framework NetFx4 already installed'
}
}
function InstallBareTail
{
[System.ComponentModel.Description('Install BareTail pro with custom profile')]
[CmdletBinding(HelpURI = 'cmd')] param()
$target = "$tools\BareTail"
if (!(Test-Path $target))
{
#https://baremetalsoft.com/baretail/download.php?p=m
HighTitle 'BareTail'
New-Item $target -ItemType Directory -Force -Confirm:$false | Out-Null
DownloadBootstrap 'baretail.zip' $target
}
else
{
WriteOK 'BareTail already installed'
}
}
function InstallGreenshot
{
[System.ComponentModel.Description('choco Greenshot')]
[CmdletBinding(HelpURI = 'cmd')] param()
if (UnChocolatized 'greenshot')
{
# Get-AppxPackage *Microsoft.ScreenSketch* -AllUsers | Remove-AppxPackage -AllUsers
## disable the Win-Shift-S hotkey for ScreenSnipper
# $0 = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
# New-ItemProperty -Path $0 -Name 'DisabledHotkeys' -Value 'S' -ErrorAction:SilentlyContinue
Highlight 'A warning dialog will appear about hotkeys - ignore it' 'Cyan'
Chocolatize 'greenshot'
}
else
{
WriteOK 'Greenshot already installed'
}
}
function InstallMacrium
{
[System.ComponentModel.Description('Download Macrium installer bootstrap')]
[CmdletBinding(HelpURI = 'cmd')] param()
if (!(Test-Path "$env:ProgramFiles\Macrium\Reflect"))
{
$target = "$tools\Reflect"
New-Item $target -ItemType Directory -Force -Confirm:$false | Out-Null
# Do NOT use chocolatey to install reflect-free because that includes a version of
# autohotkey that Cortex antivirus detects as malware but the base installer does not
DownloadBootstrap 'ReflectDLHF.zip' $target
$reminder = 'Macrium Reflect', `
' 0. Run the Macrium Reflect Free installer after VS is installed', `
" 1. The installer is here: $target", `
' 2. Choose Free version, no registration is necessary'
$script:reminders += ,$reminder
Highlight $reminder 'Cyan'
# This runs the downloader and leaves the dialog visible!
#& $tools\ReflectDL.exe
}
else
{
WriteOK 'Macrium installer already installed'
}
}
function InstallNotepadPP
{
[System.ComponentModel.Description('choco Notepadplusplus, pluginmanager, and custom configs')]
[CmdletBinding(HelpURI = 'cmd')] param()
if (UnChocolatized 'notepadplusplus')
{
Chocolatize 'notepadplusplus'
Chocolatize 'npppluginmanager'
$themes = "$env:ProgramFiles\notepad++\themes"
New-Item $themes -ItemType Directory -Force
Copy-Item "$home\Documents\$shell\Themes\Dark Selenitic npp.xml" "$themes\Dark Selenitic.xml"
# includes a dark-selenitic Markdown lang theme
$0 = "$($env:APPDATA)\Notepad++"
DownloadBootstrap 'npp-config.zip' $0
# expand %appdata% in GUIConfig[stylerTheme] attribute
$0 = "$($env:APPDATA)\Notepad++\config.xml"
Get-Content $0 | foreach { [System.Environment]::ExpandEnvironmentVariables($_) } | Out-File $0
<# To do this manually, in elevated CMD prompt:
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" `
/v "Debugger" /t REG_SZ /d "\"%ProgramFiles%\Notepad++\notepad++.exe\" -notepadStyleCmdline -z" /f
#>
# replace notepad.exe
HighTitle 'Replacing notepad with notepad++'
$0 = 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe'
$exe = (Get-Command 'notepad++').Source
$cmd = """$exe"" -notepadStyleCmdline -z"
if (!(Test-Path $0)) { New-Item -Path $0 -Force | Out-Null }
New-ItemProperty -Path $0 -Name 'Debugger' -Value $cmd -Force | Out-Null
# add Open with Notepad to Explorer context menu
Push-Location -LiteralPath 'HKLM:\SOFTWARE\Classes\*\shell'
New-Item -Path 'Open with Notepad\command' -Force | New-ItemProperty -Name '(Default)' -Value 'notepad "%1"'
Pop-Location
}
else
{
WriteOK 'Notepad++ already installed'
}
}
function InstallSysInternals
{
[System.ComponentModel.Description('Download custom collection of sysinternals')]
[CmdletBinding(HelpURI = 'cmd')] param()
$target = "$tools\SysInternals"
if (!(Test-Path $target))
{
HighTitle 'SysInternals'
New-Item $target -ItemType Directory -Force -Confirm:$false | Out-Null
DownloadBootstrap 'SysInternals.zip' $target
}
else
{
WriteOK 'SysInternals already installed'
}
$target = "$tools\volumouse"
if (!(Test-Path $target))
{
HighTitle 'Volumouse'
New-Item $target -ItemType Directory -Force -Confirm:$false | Out-Null
DownloadBootstrap 'volumouse-x64.zip' $target
# add to Startup
$0 = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run'
$1 = '"C:\tools\volumouse\volumouse.exe" /nodlg'
New-ItemProperty -Path $0 -Name '$Volumouse$' -Value $1 -ErrorAction:SilentlyContinue
& $target\volumouse.exe
}
else
{
WriteOK 'Volumouse already installed'
}
}
function InstallPowerToys
{
[System.ComponentModel.Description('Install Microsoft PowerToys')]
[CmdletBinding(HelpURI = 'cmd')] param()
if ((winget list --id Microsoft.PowerToys | where { $_ -like '*PowerToys*' }).Count -eq 0)
{
winget install Microsoft.PowerToys --source winget
}
}
function InstallTerminal
{
[System.ComponentModel.Description('choco Windows Terminal')]
[CmdletBinding(HelpURI = 'cmd')] param()
<#
UPGRADE NOTE - Can upgrade with these steps:
1. choco update microsoft-window-terminal
2. New-RunasShortcut C:\Tools\wt.lnk "....\wt.exe" (path built as below)
3. Manually pin that wt.lnk shortcut to taskbar
#>
## winget install --id=Microsoft.WindowsTerminal -e --source winget
$parentId = (gwmi win32_process -Filter "processid='$pid'").parentprocessid
if ((gwmi win32_process -Filter "processid='$parentId'").Name -eq 'WindowsTerminal.exe')
{
Write-Host 'Cannot install microsoft-windows-terminal from a Windows Terminal console' -ForegroundColor Red
return
}
Chocolatize 'microsoft-windows-terminal'
ConfigureTerminalSettings
if (!(IsWindows11))
{
ConfigureTerminalShortcut
}
$reminder = 'Windows Terminal', `
" 0. Pin C:\Tools\wt.lnk to Taskbar", `
' 1. initialPosition can be set globally in settings.json ("x,y" value)'
$script:reminders += ,$reminder
Highlight $reminder 'Cyan'
}
function ConfigureTerminalSettings
{
[System.ComponentModel.Description('Download Windows Terminal custom configs')]
[CmdletBinding(HelpURI = 'cmd')] param()
# customize settings... for Terminal 1.8.1444.0, 1.9.1942.0
$appName = 'Microsoft.WindowsTerminal'
$appKey = '8wekyb3d8bbwe'
$0 = "$($env:LOCALAPPDATA)\Packages\$appName`_$appKey\LocalState\settings.json"
if (!(Test-Path $0))
{
# when Terminal is first installed, no settings file exists so download default
$zip = ((choco list -l -r -e microsoft-windows-terminal) -replace '\|','_') + '.json.zip'
Write-Host "Downloading default Terminal settings file $zip" -ForegroundColor DarkGray
DownloadBootstrap $zip (Split-Path $0)
}
# must remove comments to feed into ConvertFrom-Json
$settings = (Get-Content $0) -replace '^\s*//.*' | ConvertFrom-Json
$settings.initialCols = 160
$settings.initialRows = 85
$settings.initialPosition = '200,25'
$scheme = New-Object -TypeName PsObject -Property @{
background = '#080808'
black = '#0C0C0C'
blue = '#3465A4'
brightBlack = '#767676'
brightBlue = '#729FCF'
brightCyan = '#34E2E2'
brightGreen = '#8AE234'
brightPurple = '#AD7FA8'
brightRed = '#EF2929'
brightWhite = '#F2F2F2'
brightYellow = '#FCE94F'
cursorColor = '#FFFFFF'
cyan = '#06989A'
foreground = '#CCCCCC'
green = '#4E9A06'
name = 'DarkSelenitic'
purple = '#75507B'
red = '#CC0000'
selectionBackground = '#FFFFFF'
white = '#CCCCCC'
yellow = '#C4A000'
}
$schemes = [Collections.Generic.List[Object]]($settings.schemes)
$index = $schemes.FindIndex({ $args[0].name -eq 'DarkSelenitic' })
if ($index -lt 0) {
$settings.schemes += $scheme
} else {
$settings.schemes[$index] = $scheme
}
$profile = $settings.profiles.list | where { $_.commandline -and (Split-Path $_.commandline -Leaf) -eq 'powershell.exe' }
if ($profile)
{
$profile.antialiasingMode = 'aliased'
$profile.colorScheme = 'DarkSelenitic'
$profile.cursorShape = 'underscore'
$profile.font.face = 'Lucida Console'
$profile.font.size = 9
$png = Join-Path ([Environment]::GetFolderPath('MyPictures')) 'architecture.png'
if (!(Test-Path $png))
{
$png = "$($env:APPDATA)\ConEmu\architecture.png"
}
if (Test-Path $png)
{
if ($profile.backgroundImage) {
$profile.backgroundImage = $png
} else {
$profile | Add-Member -MemberType NoteProperty -Name 'backgroundImage' -Value $png
}
if ($profile.backgroundImageOpacity) {
$profile.backgroundImageOpacity = 0.03
} else {
$profile | Add-Member -MemberType NoteProperty -Name 'backgroundImageOpacity' -Value 0.03
}
}
}
# use -Depth to retain fidelity in complex objects without converting
# object properties to key/value collections
ConvertTo-Json $settings -Depth 100 | Out-File $0 -Encoding Utf8
}
function ConfigureTerminalShortcut
{
[System.ComponentModel.Description('create shortcut for Windows Terminal (PoC)')]
[CmdletBinding(HelpURI = 'cmd')] param()
# Create shortcut wt.lnk file; this then needs to be manually pinned to taskbar
$appName = 'Microsoft.WindowsTerminal'
$appKey = '8wekyb3d8bbwe'
$version = (choco list -l -r -e microsoft-windows-terminal).Split('|')[1]
New-RunasShortcut C:\Tools\wt.lnk "$($env:ProgramFiles)\WindowsApps\$appName`_$version`_x64__$appKey\wt.exe"
}
function HyperVInstalled
{
((Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online).State -eq 'Enabled')
}
function DisableCFG
{
[System.ComponentModel.Description('Disable Code Flow Guard for vmcomputer service')]
[CmdletBinding(HelpURI = 'cmd')] param()
if (!(HyperVInstalled))
{
Highlight '... Cannot disable CFG until Hyper-V is installed'
return
}
<#
Following is from online to troubleshoot startup errors:
1, Open "Window Security"
2, Open "App & Browser control"
3, Click "Exploit protection settings" at the bottom
4, Switch to "Program settings" tab
5, Locate "C:\WINDOWS\System32\vmcompute.exe" in the list and expand it
6, Click "Edit"
7, Scroll down to "Code flow guard (CFG)" and uncheck "Override system settings"
8, Start vmcompute from powershell "net start vmcompute"
#>
$0 = 'C:\WINDOWS\System32\vmcompute.exe'
if ((Get-ProcessMitigation -Name $0).CFG.Enable -eq 'ON')
{
# disable Code Flow Guard (CFG) for vmcompute service
Set-ProcessMitigation -Name $0 -Disable CFG
Set-ProcessMitigation -Name $0 -Disable StrictCFG
# restart service
net stop vmcompute
net start vmcompute
}
}
#==============================================================================================
# DEVELOPER
function InstallDotNetSDK
{
[System.ComponentModel.Description('Install .NET 6 SDK')]
[CmdletBinding(HelpURI = 'cmd')] param()
# .NET SDK
if ((dotnet --list-sdks | where { $_ -match '6\.0\.' }).Count -eq 0)
{
HighTitle '.NET 6.0 SDK'
choco install -y dotnet-sdk
}
else
{
WriteOK '.NET 6.0 SDK already installed'
}
}
function InstallNodeJs
{
[System.ComponentModel.Description('choco nodejs')]
[CmdletBinding(HelpURI = 'cmd')] param()
if ((Get-Command node -ErrorAction:SilentlyContinue) -eq $null)
{
HighTitle 'nodejs'
#choco install -y nodejs --version 12.16.3
choco install -y nodejs
# update session PATH so we can continue
$npmpath = [Environment]::GetEnvironmentVariable('PATH', 'Machine') -split ';' | where { $_ -match 'nodejs' }
$env:PATH = (($env:PATH -split ';') -join ';') + ";$npmpath"
}
else
{
WriteOK 'Nodejs already installed'
}
}
function InstallAngular
{
[System.ComponentModel.Description('npm install latest Angular and helper packages')]
[CmdletBinding(HelpURI = 'cmd')] param()
if ((Get-Command ng -ErrorAction:SilentlyContinue) -eq $null)
{
HighTitle 'angular'
npm install -g @angular/cli@latest
npm install -g npm-check-updates
npm install -g local-web-server
# patch Process path until shell is restarted
$env:PATH = (($env:PATH -split ';') -join ';') + ";$($env:APPDATA)\npm"
}
else
{
WriteOK 'Angular already installed'
}
}
function InstallAWSCLI
{
[System.ComponentModel.Description('choco awscli')]
[CmdletBinding(HelpURI = 'cmd')] param()
if ((Get-Command aws -ErrorAction:SilentlyContinue) -ne $null)
{
return
}
$0 = 'C:\Program Files\Amazon\AWSCLIV2'
if (!(Test-Path $0))
{
# ensure V2.x of awscli is available on chocolatey.org
if ((choco list awscli -limit-output | select-string 'awscli\|2' | measure).count -gt 0)
{
Chocolatize 'awscli'
# alternatively...
#msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
}
else
{
HighTitle 'awscli (direct)'
# download package directly and install
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
$msi = "$env:TEMP\awscliv2.msi"
$progressPreference = 'silentlyContinue'
Invoke-WebRequest 'https://awscli.amazonaws.com/AWSCLIV2.msi' -OutFile $msi
$progressPreference = 'Continue'
if (Test-Path $msi)
{
& $msi /quiet
}
}
}
# path will be added to Machine space when installed so
# fix Process path so we can continue to install add-ons
if ((Get-Command aws -ErrorAction:SilentlyContinue) -eq $null)
{
$env:PATH = (($env:PATH -split ';') -join ';') + ";$0"
}
if ((Get-Command aws -ErrorAction:SilentlyContinue) -ne $null)
{
Highlight 'aws command verified' 'Cyan'
}
}
function InstallDockerDesktop
{
[System.ComponentModel.Description('choco Docker Desktop')]
[CmdletBinding(HelpURI = 'cmd')] param()
if (!(HyperVInstalled))
{
Highlight '... Hyper-V must be installed before Docker Desktop'
return
}
if (UnChocolatized 'docker-desktop')
{
Chocolatize 'docker-desktop'
$reminder = 'Docker Desktop', `
' 0. Restart console window to get updated PATH', `
' 1. Unsecure repos must be added manually'
$reminders += ,$reminder
Highlight $reminder 'Cyan'
}
else
{
WriteOK 'Docker Desktop already installed'
}
}
function InstallS3Browser
{
[System.ComponentModel.Description('choco S3Browser')]
[CmdletBinding(HelpURI = 'cmd')] param()
if (UnChocolatized 's3browser')
{
Chocolatize 's3browser'
}
else
{
WriteOK 's3browser already installed'
}
}
#==============================================================================================
# EXTRAS
function InstallDateInTray
{
[System.ComponentModel.Description('Download DateInTray (for Windows 10)')]
[CmdletBinding(HelpURI = 'cmd')] param()
$target = "$tools\DateInTray"
if (!(Test-Path $target))
{
#https://softpedia-secure-download.com/dl/ba833328e1e20d7848a5498418cb5796/5dfe1db7/100016805/software/os_enhance/DITSetup.exe
HighTitle 'DateInTray'
New-Item $target -ItemType Directory -Force -Confirm:$false | Out-Null
DownloadBootstrap 'DateInTray.zip' $target
# add to Startup
$0 = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run'
$hex = [byte[]](0x20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
New-ItemProperty -Path $0 -Name 'DateInTray' -PropertyType Binary -Value $hex -ErrorAction:SilentlyContinue
$0 = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run'
New-ItemProperty -Path $0 -Name 'DateInTray' -Value "$target\DateInTray.exe" -ErrorAction:SilentlyContinue
& $target\DateInTray.exe
}
else
{
WriteOK 'DateInTray already installed'
}
}
function InstallGreenfish
{
[System.ComponentModel.Description('Download Greenfish icon editor')]
[CmdletBinding(HelpURI='cmd')] param()
# http://greenfishsoftware.org/gfie.php
$0 = 'C:\Program Files (x86)\Greenfish Icon Editor Pro 3.6\gfie.exe'
if (!(Test-Path $0))
{
# preprequisite
InstallNetFx3
HighTitle 'Greenfish'
# download the installer
$name = 'greenfish_icon_editor_pro_setup_3.6'
DownloadBootstrap "$name`.zip" $env:TEMP
# run the installer
& "$($env:TEMP)\$name`.exe" /verysilent
}
else
{
WriteOK 'Greenfish already installed'
}
}
function InstallWiLMa
{
[System.ComponentModel.Description('Download Windows Layout Manager')]
[CmdletBinding(HelpURI = 'cmd|extra')] param()
$target = "$tools\WiLMa"
if (!(Test-Path $target))
{
HighTitle 'WiLMa'
New-Item $target -ItemType Directory -Force -Confirm:$false | Out-Null
# http://www.stefandidak.com/wilma/winlayoutmanager.zip
# but this is my custom NetFx4.8 build of WilMa
DownloadBootstrap 'winlayoutmanager.zip' $target
# Register WindowsLayoutManager sheduled task to run as admin
$trigger = New-ScheduledTaskTrigger -AtLogOn
$action = New-ScheduledTaskAction -Execute "$target\WinLayoutManager.exe"
$principal = New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" -RunLevel Highest
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "WiLMa" -Principal $principal
Start-Process $target\WinLayoutManager.exe -Verb runas
}
else
{
WriteOK 'WiLMa already installed'
}
}
function InstallWmiExplorer
{
[System.ComponentModel.Description('Download WMI Explorer')]
[CmdletBinding(HelpURI = 'cmd|extra')] param()
$target = "$tools\WmiExplorer"
if (!(Test-Path $target))
{
HighTitle 'WmiExplorer'
New-Item $target -ItemType Directory -Force -Confirm:$false | Out-Null
DownloadBootstrap 'wmiexplorer.zip' $target
}
else
{
WriteOK 'WmiExplorer already installed'
}
}
}
Process
{
if ($ListCommands)
{
GetCommandList
return
}
if (!(IsElevated))
{
return
}
# prerequisites... should have been installed by Initialize-Machine
InstallChocolatey
InstallCurl
InstallGit
if ($command)
{
InvokeCommand $command
return
}
# BASE...
InstallDotNetRuntime
InstallNetFx4
if ($Continuation -or !($Developer -or $Extras))
{
CleanupContinuation
InstallBareTail
InstallGreenshot
InstallMacrium
InstallNotepadPP
InstallSysInternals
InstallPowerToys
if (!(IsWindows11)) {
InstallTerminal
}
DisableCFG
Chocolatize 'adobereader'
Chocolatize 'dotnet'
Chocolatize 'mRemoteNG'
Chocolatize 'procexp'
Chocolatize 'procmon'
Chocolatize 'sharpkeys'
}
# DEVELOPER...
if ($Developer)
{
InstallDotNetSDK
InstallNodeJs
InstallAngular
InstallAWSCli
InstallDockerDesktop
#InstallS3Browser
Chocolatize 'k9s'
Chocolatize 'linqpad'
Chocolatize 'nuget.commandline'
#Chocolatize 'robo3t'
}
# EXTRAS...
if ($Extras)
{
if (!(IsWindows11)) {
InstallDateInTray
}
InstallGreenfish
InstallWilMa
InstallWmiExplorer
Chocolatize 'audacity' # audio editor
#Chocolatize 'dopamine' # music player
Chocolatize 'licecap'
Chocolatize 'paint.net'
Chocolatize 'treesizefree'
Chocolatize 'vlc'
}
# done...
$reminder = 'Consider these manually installed apps:', `
' - BeyondCompare (there is a choco package but not for 4.0)', `
' - OneMore OneNote add-in (https://github.com/stevencohn/OneMore/releases)', `
' - Paint.NET IcoCurType plugin (https://github.com/stevencohn/PDN-IcoCurType)'
$script:reminders += ,$reminder
$line = New-Object String('*',80)
Write-Host
Write-Host $line -ForegroundColor Cyan
Write-Host ' Reminders ...' -ForegroundColor Cyan
Write-Host $line -ForegroundColor Cyan
Write-Host
$script:reminders | foreach { $_ | foreach { Write-Host $_ -ForegroundColor Cyan }; Write-Host }
WriteOK '... Initialization compelete'
Read-Host '... Press Enter to finish'
}