-
Notifications
You must be signed in to change notification settings - Fork 39
/
AIBPortalInstallApps.ps1
82 lines (75 loc) · 2.67 KB
/
AIBPortalInstallApps.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
# Software install Script
#
# Applications to install:
#
# Foxit Reader Enterprise Packaging (requires registration)
# https://kb.foxitsoftware.com/hc/en-us/articles/360040658811-Where-to-download-Foxit-Reader-with-Enterprise-Packaging-MSI-
#
# Notepad++
# https://notepad-plus-plus.org/downloads/v7.8.8/
#region Set logging
$logFile = "c:\ImageBuilder\" + (get-date -format 'yyyyMMdd') + '_softwareinstall.log'
function Write-Log {
Param($message)
Write-Output "$(get-date -format 'yyyyMMdd HH:mm:ss') $message" | Out-File -Encoding utf8 $logFile -Append
}
#endregion
#region Foxit Reader
try {
Start-Process -filepath msiexec.exe -Wait -ErrorAction Stop -ArgumentList '/i', 'c:\ImageBuilder\FoxitPDFReader1211_enu_Setup.msi', '/quiet', 'ADDLOCAL="FX_PDFVIEWER"'
if (Test-Path "C:\Program Files (x86)\Foxit Software\Foxit PDF Reader\FoxitPDFReader.exe") {
Write-Log "Foxit Reader has been installed"
}
else {
write-log "Error locating the Foxit Reader executable"
}
}
catch {
$ErrorMessage = $_.Exception.message
write-log "Error installing Foxit Reader: $ErrorMessage"
}
#endregion
#region Notepad++
try {
Start-Process -filepath 'c:\ImageBuilder\npp.8.5.2.Installer.x64.exe' -Wait -ErrorAction Stop -ArgumentList '/S'
if (Test-Path "C:\Program Files\Notepad++\notepad++.exe") {
Write-Log "Notepad++ has been installed"
}
else {
write-log "Error locating the Notepad++ executable"
}
}
catch {
$ErrorMessage = $_.Exception.message
write-log "Error installing Notepad++: $ErrorMessage"
}
#endregion
#region Sysprep Fix
# Fix for first login delays due to Windows Module Installer
try {
((Get-Content -path C:\DeprovisioningScript.ps1 -Raw) -replace 'Sysprep.exe /oobe /generalize /quiet /quit', 'Sysprep.exe /oobe /generalize /quit /mode:vm' ) | Set-Content -Path C:\DeprovisioningScript.ps1
write-log "Sysprep Mode:VM fix applied"
}
catch {
$ErrorMessage = $_.Exception.message
write-log "Error updating script: $ErrorMessage"
}
#endregion
#region Time Zone Redirection
$Name = "fEnableTimeZoneRedirection"
$value = "1"
# Add Registry value
try {
New-ItemProperty -ErrorAction Stop -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" -Name $name -Value $value -PropertyType DWORD -Force
if ((Get-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services").PSObject.Properties.Name -contains $name) {
Write-log "Added time zone redirection registry key"
}
else {
write-log "Error locating the Teams registry key"
}
}
catch {
$ErrorMessage = $_.Exception.message
write-log "Error adding teams registry KEY: $ErrorMessage"
}
#endregion