@@ -16,7 +16,7 @@ Get-ChildItem -Recurse *.ps*1 | Unblock-File
16
16
$env: SEE_MASK_NOZONECHECKS = 1
17
17
[Net.ServicePointManager ]::SecurityProtocol = [Net.SecurityProtocolType ]::Tls12
18
18
[System.Net.WebRequest ]::DefaultWebProxy.Credentials = [System.Net.CredentialCache ]::DefaultCredentials
19
- $Modules = @ (" PSADT" , " Evergreen " ) # Modules list
19
+ $Modules = @ (" PSADT" , " Nevergreen " ) # Modules list
20
20
21
21
Function Get-ScriptPath
22
22
{
@@ -177,24 +177,34 @@ Foreach ($Module in $Modules)
177
177
# -----------------------------------------------------------[Functions]------------------------------------------------------------
178
178
179
179
# region Functions
180
+
180
181
# endregion
181
182
182
183
# ----------------------------------------------------------[Declarations]----------------------------------------------------------
183
184
185
+ # region Declarations
186
+
184
187
$appName = " FileZilla"
185
188
$appProcesses = @ (" filezilla" , " fzputtygen" , " fzsftp" )
186
189
$appInstallParameters = " /S /user=all"
190
+ # Set browser agent, powershell is blocked - https://twitter.com/xenappblog/status/1659325235127042050
191
+ $userAgent = [Microsoft.PowerShell.Commands.PSUserAgent ]::Chrome
187
192
$Evergreen = Get-EvergreenApp - Name $appName
188
- $appVersion = $Evergreen.Version
189
193
$appURL = $Evergreen.URI
194
+ $appVersion = $Evergreen.Version
190
195
$appSetup = Split-Path - Path $appURL - Leaf
191
- $appLanguage = " fr"
196
+ $appConfigURL = " https://raw.githubusercontent.com/JonathanPitre/Apps/master/FileZilla/fzdefaults.xml"
197
+ $appConfig = Split-Path - Path $appConfigURL - Leaf
192
198
$appDestination = " $env: ProgramFiles \FileZilla FTP Client"
193
- [boolean ]$IsAppInstalled = [boolean ](Get-InstalledApplication - Name " $appName .*" - RegEx)
194
- $appInstalledVersion = ((Get-InstalledApplication - Name " $appName .*" - RegEx).DisplayVersion))
199
+ [boolean ]$isAppInstalled = [boolean ](Get-InstalledApplication - Name " $appName .*" - RegEx)
200
+ $appInstalledVersion = ((Get-InstalledApplication - Name " $appName .*" - RegEx).DisplayVersion)
201
+
202
+ # endregion
195
203
196
204
# -----------------------------------------------------------[Execution]------------------------------------------------------------
197
205
206
+ # region Execution
207
+
198
208
If ([version ]$appVersion -gt [version ]$appInstalledVersion )
199
209
{
200
210
Set-Location - Path $appScriptPath
@@ -205,7 +215,18 @@ If ([version]$appVersion -gt [version]$appInstalledVersion)
205
215
If (-Not (Test-Path - Path $appScriptPath \$appVersion \$appSetup ))
206
216
{
207
217
Write-Log - Message " Downloading $appName $appVersion ..." - Severity 1 - LogType CMTrace - WriteHost $True
208
- Invoke-WebRequest - UseBasicParsing - Uri $appURL - OutFile $appSetup
218
+ Invoke-WebRequest - UseBasicParsing - Uri $appURL - OutFile $appSetup - UserAgent $userAgent
219
+ }
220
+ Else
221
+ {
222
+ Write-Log - Message " File(s) already exists, download was skipped." - Severity 1 - LogType CMTrace - WriteHost $True
223
+ }
224
+
225
+ # Download required config file
226
+ If (-Not (Test-Path - Path " $appScriptPath \$appConfig " ))
227
+ {
228
+ Write-Log - Message " Downloading $appName Config.." - Severity 1 - LogType CMTrace - WriteHost $True
229
+ Invoke-WebRequest - UseBasicParsing - Uri $appConfigURL - OutFile " $appScriptPath \$appConfig " - UserAgent $userAgent
209
230
}
210
231
Else
211
232
{
@@ -227,33 +248,8 @@ If ([version]$appVersion -gt [version]$appInstalledVersion)
227
248
228
249
Write-Log - Message " Applying customizations..." - Severity 1 - LogType CMTrace - WriteHost $True
229
250
230
- <#
231
- # Configure application shortcut
232
- Copy-File -Path "$envCommonStartMenuPrograms\$appName\$appName File Manager.lnk" -Destination "$envCommonStartMenuPrograms" -ContinueFileCopyOnError $True
233
- Remove-Folder -Path "$envCommonStartMenuPrograms\$appName" -ContinueOnError $True
234
-
235
- # Load the Default User registry hive
236
- Write-Log -Message "Loading the Default User registry hive..." -Severity 1 -LogType CMTrace -WriteHost $True
237
- Start-Sleep -Seconds 5
238
- Execute-Process -Path "$envWinDir\System32\reg.exe" -Parameters "LOAD HKLM\DefaultUser $envSystemDrive\Users\Default\NTUSER.DAT" -WindowStyle Hidden
239
-
240
- # Configure application display language
241
- If ($appLanguage -ne "en")
242
- {
243
- Set-RegistryKey -Key "HKLM:\DefaultUser\Software\7-Zip" -Name "Lang" -Type String -Value $appLanguage
244
- }
245
- Else
246
- {
247
- Set-RegistryKey -Key "HKLM:\DefaultUser\Software\7-Zip" -Name "Lang" -Type String -Value "-"
248
- }
249
-
250
- # Cleanup (to prevent access denied issue unloading the registry hive)
251
- [GC]::Collect()
252
- Start-Sleep -Seconds 5
253
-
254
- # Unload the Default User registry hive
255
- Execute-Process -Path "$envWinDir\System32\reg.exe" -Parameters "UNLOAD HKLM\DefaultUser" -WindowStyle Hidden
256
- #>
251
+ # Copy preferences file
252
+ Copy-File - Path " $appScriptPath \$appConfig " - Destination $appDestination
257
253
258
254
# Go back to the parent folder
259
255
Set-Location ..
@@ -264,4 +260,6 @@ If ([version]$appVersion -gt [version]$appInstalledVersion)
264
260
Else
265
261
{
266
262
Write-Log - Message " $appName $appInstalledVersion is already installed." - Severity 1 - LogType CMTrace - WriteHost $True
267
- }
263
+ }
264
+
265
+ # endregion
0 commit comments