-
Notifications
You must be signed in to change notification settings - Fork 11
/
HPIARepo_Downloader_2.04.02.ps1
3420 lines (2909 loc) · 174 KB
/
HPIARepo_Downloader_2.04.02.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
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<#
HP Image Assistant Softpaq Repository Downloader
by Dan Felman/HP Technical Consultant
Loop Code: The 'HPModelsTable' loop code, is in a separate INI.ps1 file
... created by Gary Blok's (@gwblok) post on garytown.com.
... https://garytown.com/create-hp-bios-repository-using-powershell
Logging: The Log function based on code by Ryan Ephgrave (@ephingposh)
... https://www.ephingadmin.com/powershell-cmtrace-log-function/
Version informtion in Release_Notes.txt
Args
-inifile - full path to ini.ps1 file , also 1st arg in command line
#>
[CmdletBinding()]
param(
[Parameter( Mandatory = $false, Position = 0, ValueFromRemainingArguments )]
[Switch]$Help, # $help is set to $true if '-help' passed as argument
[Parameter( Mandatory = $false, Position = 1, HelpMessage="Path to ini.ps1 file. Default: 'HPIARepo_ini.ps1'" )]
[AllowEmptyString()]
[string]$inifile=".\HPIARepo_ini.ps1",
[Parameter( Mandatory = $false, Position = 2 )]
[ValidateSet('individual', 'Common')]
[string]$RepoStyle='individual',
[Parameter( Mandatory = $false, Position = 3 )]
[array]$products=$null,
[Parameter( Mandatory = $false )]
[Switch]$ListFilters,
[Parameter( Mandatory = $false )]
[Switch]$noIniSw=$false,
[Parameter( Mandatory = $false )]
[Switch]$showActivityLog=$false,
[Parameter( Mandatory = $false )]
[Switch]$newLog=$false,
[Parameter( Mandatory = $false, Position = 0, ValueFromRemainingArguments )]
[Switch]$Sync
) # param
$ScriptVersion = "2.04.02 (Feb 23, 2024)"
#=====================================================================================
# manage script runtime parameters
#=====================================================================================
if ( $help ) {
"`nRunning script without parameters opens in UI mode. This mode should be used to set up needed filters and develop Repositories"
"`nRuntime options:"
"`n[-help|-h] will display this text"
"`nHPIARepo_Downloader_1.90.ps1 [[-Sync] [-ListFilters] [-inifile .\<filepath>\HPIARepo_ini.ps1] [-RepoStyle common|individual] [-products '80D4,8549,8470'] [-NoIniSw] [-ShowActivityLog]]`n"
"... <-IniFile>, <-RepoStyle>, <-Productsts> parameters can also be positional without parameter names. In this case, every parameter counts"
"`nExample: HPIARepo_Downloader_1.90.ps1 .\<path>\HPIARepo_ini.ps1 Common '80D4,8549,8470'`n"
"-ListFilters`n`tlist repository filters in place on selected product repositories"
"-IniFile <path to INI.ps1>`n`tthis option can be used when running from a script to set up different downloads."
"`tIf option not give, it will default to .\HPIARepo_ini.ps1"
"-RepoStyle {Common|Individual}`n`tthis option selects the repository style used by the downloader script"
"`t`t'Common' - There will be a single repository used for all models - path extracted from INI.ps1 file"
"`t`t'Individual' - Each model will have its own repository folder"
"-Products '1234', '2222'`n`ta list of HP Model Product codes, as example '80D4,8549,8470'"
"`tIf omitted, any entry in the INI.ps1 file that has a repository created will be updated"
"-NoIniSw`n`tPrevent from syncing Softpaqs listed by name in INI file"
"-showActivityLog`n`tShow output from CMSL Sync/Cleanup activity log"
"`tThis option is useful when using -Sync"
"-newLog`n`tstart new log file in script's directory - backup current log"
"-Sync`n`tUse Hp CMSL commands to sync repositories. Command assumes repositories already created with script in UI mode"
exit
}
$RunUI = $true # default to displaying a UI
#=====================================================================================
# get the path to the running script, and populate name of INI configuration file
$scriptName = $MyInvocation.MyCommand.Name
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path
Set-Location $ScriptPath
'Script invoked from: '+$ScriptPath
#--------------------------------------------------------------------------------------
#$IniFile = "HPIARepo_ini.ps1" # assume this INF file in same location as script
#$IniFileRooted = [System.IO.Path]::IsPathRooted($IniFile)
if ( [System.IO.Path]::IsPathRooted($IniFile) ) {
$IniFIleFullPath = $IniFile
} else {
$IniFIleFullPath = "$($ScriptPath)\$($IniFile)"
} # else if ( [System.IO.Path]::IsPathRooted($IniFile) )
if ( -not (Test-Path $IniFIleFullPath) ) {
"-IniFile '$IniFIleFullPath' file not found!!! Can't continue"
exit
}
. $IniFIleFullPath # source/read the code in the INI file
# with v2.00, we introduce $v_OPSYS variable to handle win10/11 OS versions
if ( -not (Get-Variable -Name v_OPSYS -ErrorAction SilentlyContinue) ) {
'Need updated INI file (required to support Win11)' ; exit
}
#--------------------------------------------------------------------------------------
# add required .NET framwork items to support GUI
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName System.Windows.Forms
#--------------------------------------------------------------------------------------
# Script Environment Vars
$CMConnected = $false # is a connection to SCCM established?
$SiteCode = $null
$s_ModelAdded = $False # set $True when user adds models to list in the UI
Set-Variable s_AddSoftware -Option Constant -Value '.ADDSOFTWARE'
#$s_AddSoftware = '.ADDSOFTWARE' # sub-folders where named downloaded Softpaqs will reside
Set-Variable s_HPIAActivityLog -Option Constant -Value 'activity.log'
#$s_HPIAActivityLog = 'activity.log' # name of HPIA activity log file
$s_AddAccesories = $false # FUTURE USE #
'My Public IP: '+(Invoke-WebRequest ifconfig.me/ip).Content.Trim() | Out-Host
#--------------------------------------------------------------------------------------
# error codes for color coding, etc.
Set-Variable TypeError -Option Constant -Value -1
Set-Variable TypeNorm -Option Constant -Value 1
Set-Variable TypeWarn -Option Constant -Value 2
Set-Variable TypeDebug -Option Constant -Value 4
Set-Variable TypeSuccess -Option Constant -Value 5
Set-Variable TypeNoNewline -Option Constant -Value 10
#=====================================================================================
#region: CMTraceLog Function formats logging in CMTrace style
function CMTraceLog {
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)] $Message,
[Parameter(Mandatory = $false)] $ErrorMessage,
[Parameter(Mandatory = $false)] $Component = "HP HPIA Repository Downloader",
[Parameter(Mandatory = $false)] [int]$Type
)
<#
Type: 1 = Normal, 2 = Warning (yellow), 3 = Error (red)
#>
$Time = Get-Date -Format "HH:mm:ss.ffffff"
$Date = Get-Date -Format "MM-dd-yyyy"
if ($null -ne $ErrorMessage) { $Type = $TypeError }
if ($Component -eq $null) { $Component = " " }
if ($null -eq $Type) { $Type = $TypeNorm }
$LogMessage = "<![LOG[$Message $ErrorMessage" + "]LOG]!><time=`"$Time`" date=`"$Date`" component=`"$Component`" context=`"`" type=`"$Type`" thread=`"`" file=`"`">"
#$Type = 4: Debug output ($TypeDebug)
#$Type = 10: no \newline ($TypeNoNewline)
if ( ($Type -ne $TypeDebug) -or ( ($Type -eq $TypeDebug) -and $v_DebugMode) ) {
$LogMessage | Out-File -Append -Encoding UTF8 -FilePath $Script:v_LogFile
# Add output to GUI message box
OutToForm $Message $Type $Script:TextBox
} else {
$lineNum = ((get-pscallstack)[0].Location -split " line ")[1] # output: CM_HPIARepo_Downloader.ps1: line 557
Write-Host "$lineNum $(Get-Date -Format "HH:mm:ss") - $Message"
}
} # function CMTraceLog
#=====================================================================================
<#
Function OutToForm
Designed to output message to Form's message box
it uses color coding of text for different message types
#>
Function OutToForm {
[CmdletBinding()]
param( $pMessage, [int]$pmsgType, $pTextBox)
if ( $pmsgType -eq $TypeDebug ) {
$pMessage = '{dbg}'+$pMessage
}
if ($RunUI) {
switch ( $pmsgType ) {
-1 { $pTextBox.SelectionColor = "Red" } # Error
1 { $pTextBox.SelectionColor = "Black" } # default color is black
2 { $pTextBox.SelectionColor = "Brown" } # Warning
4 { $pTextBox.SelectionColor = "Orange" } # Debug Output
5 { $pTextBox.SelectionColor = "Green" } # success details
10 { $pTextBox.SelectionColor = "Black" } # do NOT add \newline to message output
} # switch ( $pmsgType )
# message Tpye = 10/$TypeNeNewline prevents a nl so next output is written contiguous
if ( $pmsgType -eq $TypeNoNewline ) {
$pTextBox.AppendText("$($pMessage) ")
} else {
$pTextBox.AppendText("$($pMessage) `n")
}
$pTextBox.Refresh()
$pTextBox.ScrollToCaret()
} else {
$pMessage | Out-Host
}
} # Function OutToForm
#=====================================================================================
<#
Function Load_HPCMSLModule
The function will test if the HP Client Management Script Library is loaded
and attempt to load it, if possible
#>
function Load_HPCMSLModule {
if ( $v_DebugMode ) { CMTraceLog -Message "> Load_HPCMSLModule" -Type $TypeNorm }
$m = 'HPCMSL'
CMTraceLog -Message "Checking for required HP CMSL modules... " -Type $TypeNoNewline
# If module is imported say that and do nothing
if (Get-Module | Where-Object {$_.Name -eq $m}) {
if ( $v_DebugMode ) { write-host "Module $m is already imported." }
CMTraceLog -Message "Module already imported." -Type $TypSuccess
} else {
# If module is not imported, but available on disk then import
if (Get-Module -ListAvailable | Where-Object {$_.Name -eq $m}) {
if ( $v_DebugMode ) { write-host "Importing Module $m." }
CMTraceLog -Message "Importing Module $m." -Type $TypeNoNewline
Import-Module $m -Verbose
CMTraceLog -Message "Done" -Type $TypSuccess
} else {
# If module is not imported, not available on disk, but is in online gallery then install and import
if (Find-Module -Name $m | Where-Object {$_.Name -eq $m}) {
if ( $v_DebugMode ) { write-host "Upgrading NuGet and updating PowerShellGet first." }
CMTraceLog -Message "Upgrading NuGet and updating PowerShellGet first." -Type $TypSuccess
if ( !(Get-packageprovider -Name nuget -Force) ) {
Install-PackageProvider -Name NuGet -ForceBootstrap
}
# next is PowerShellGet
$lPSGet = find-module powershellget
write-host 'Installing PowerShellGet version' $lPSGet.Version
Install-Module -Name PowerShellGet -Force # -Verbose
Write-Host 'should restart PowerShell after upating module PoweShellGet'
# and finally module HPCMSL
if ( $v_DebugMode ) { write-host "Installing and Importing Module $m." }
CMTraceLog -Message "Installing and Importing Module $m." -Type $TypSuccess
Install-Module -Name $m -Force -SkipPublisherCheck -AcceptLicense -Scope CurrentUser # -Verbose
Import-Module $m -Verbose
CMTraceLog -Message "Done" -Type $TypSuccess
} else {
# If module is not imported, not available and not in online gallery then abort
write-host "Module $m not imported, not available and not in online gallery, exiting."
CMTraceLog -Message "Module $m not imported, not available and not in online gallery, exiting." -Type $TypError
exit 1
}
} # else if (Get-Module -ListAvailable | Where-Object {$_.Name -eq $m})
} # else if (Get-Module | Where-Object {$_.Name -eq $m})
# report CMSL version in use
$hpcmsl = get-module -listavailable | where { $_.name -like 'HPCMSL' }
$HPCMSLVer = [string]$hpcmsl.Version.Major+'.'+[string]$hpcmsl.Version.Minor+'.'+[string]$hpcmsl.Version.Build
CMTraceLog -Message "Using CMSL version: $HPCMSLVer" -Type $TypError
if ( $v_DebugMode ) { CMTraceLog -Message "< Load_HPCMSLModule" -Type $TypeNorm }
} # function Load_HPCMSLModule
#=====================================================================================
<#
Function Test_CMConnection
The function will test the CM server connection
and that the Task Sequences required for use of the Script are available in CM
- will also test that both download and share paths exist
#>
Function Test_CMConnection {
if ( $v_DebugMode ) { CMTraceLog -Message "> Test_CMConnection" -Type $TypeNorm }
if ( $Script:CMConnected ) { return $True } # already Tested connection
$pCurrentLoc = Get-Location
CMTraceLog -Message "Connecting to CM Server: ""$FileServerName""" -Type $TypeNoNewline
#--------------------------------------------------------------------------------------
# check for ConfigMan on this server, and source the PS module
$boolConnectionRet = $False
if (Test-Path $env:SMS_ADMIN_UI_PATH) {
$tc_CMInstall = Split-Path $env:SMS_ADMIN_UI_PATH
Import-Module (Join-Path $(Split-Path $env:SMS_ADMIN_UI_PATH) ConfigurationManager.psd1)
#--------------------------------------------------------------------------------------
# by now we know the script is running on a CM server and the PS module is loaded
# so let's get the CMSite content info
Try {
$Script:SiteCode = (Get-PSDrive -PSProvider CMSite).Name # assume CM PS modules loaded at this time
if (Test-Path $tc_CMInstall) {
try { Test-Connection -ComputerName "$FileServerName" -Quiet
CMTraceLog -Message " ...Connected" -Type $TypeSuccess
$boolConnectionRet = $True
$CMGroupAll.Text = 'SCCM - Connected'
}
catch {
CMTraceLog -Message "Not Connected to File Server, Exiting" -Type $TypeError
}
} else {
CMTraceLog -Message "CM Installation path NOT FOUND: '$tcCMInstall'" -Type $TypeError
} # else
} # Try
Catch {
CMTraceLog -Message "Error obtaining CM's CMSite provider on this server" -Type $TypeError
} # Catch
} else {
CMTraceLog -Message "Can't find CM Installation on this system" -Type $TypeError
}
if ( $v_DebugMode ) { CMTraceLog -Message "< Test_CMConnection" -Type $TypeNorm }
Set-Location $pCurrentLoc
return $boolConnectionRet
} # Function Test_CMConnection
#=====================================================================================
<#
Function CM_HPIAPackage
#>
Function CM_HPIAPackage {
[CmdletBinding()]
param( $pHPIAPkgName, $pHPIAPath, $pHPIAVersion )
if ( Test_CMConnection ) {
$pCurrentLoc = Get-Location
if ( $v_DebugMode ) { CMTraceLog -Message "... setting location to: $($SiteCode)" -Type $TypeDebug }
Set-Location -Path "$($SiteCode):"
#--------------------------------------------------------------------------------
# now, see if HPIA package exists
#--------------------------------------------------------------------------------
$lCMHPIAPackage = Get-CMPackage -Name $pHPIAPkgName -Fast
if ( $null -eq $lCMHPIAPackage ) {
if ( $v_DebugMode ) { CMTraceLog -Message "... HPIA Package missing... Creating New" -Type $TypeNorm }
$lCMHPIAPackage = New-CMPackage -Name $pHPIAPkgName -Manufacturer "HP"
CMTraceLog -ErrorMessage "... HPIA package created - PackageID $lCMHPIAPackage.PackageId"
} else {
CMTraceLog -Message "... HPIA package found - PackageID $($lCMHPIAPackage.PackageId)"
}
#if ( $v_DebugMode ) { CMTraceLog -Message "... setting HPIA Package to Version: $($Script:v_OSVER), path: $($pRepoPath)" -Type $TypeDebug }
CMTraceLog -Message "... HPIA package - setting name ''$pHPIAPkgName'', version ''$pHPIAVersion'', Path ''$pHPIAPath''" -Type $TypeNorm
Set-CMPackage -Name $pHPIAPkgName -Version $pHPIAVersion
Set-CMPackage -Name $pHPIAPkgName -Path $pHPIAPath
if ( $Script:v_DistributeCMPackages ) {
CMTraceLog -Message "... updating CM Distribution Points"
update-CMDistributionPoint -PackageId $lCMHPIAPackage.PackageID
}
$lCMHPIAPackage = Get-CMPackage -Name $pHPIAPkgName -Fast # make sure we are woring with updated/distributed package
CMTraceLog -Message "... HPIA package updated - PackageID $($lCMHPIAPackage.PackageId)" -Type $TypeNorm
#--------------------------------------------------------------------------------
Set-Location -Path $pCurrentLoc
} else {
CMTraceLog -ErrorMessage "NO CM Connection to update HPIA package"
}
CMTraceLog -Message "< HCM_HPIAPackage DONE" -Type $TypeSuccess
} # CM_HPIAPackage
#=====================================================================================
<#
Function CM_RepoUpdate
#>
Function CM_RepoUpdate {
[CmdletBinding()]
param( $pModelName, $pModelProdId, $pRepoPath )
$pCurrentLoc = Get-Location
if ( $v_DebugMode ) { CMTraceLog -Message "> CM_RepoUpdate" -Type $TypeNorm }
# develop the Package name
$lPkgName = 'HP-'+$pModelProdId+'-'+$pModelName
CMTraceLog -Message "... updating repository for SCCM package: $($lPkgName)" -Type $TypeNorm
if ( $v_DebugMode ) { CMTraceLog -Message "... setting location to: $($SiteCode)" -Type $TypeDebug }
Set-Location -Path "$($SiteCode):"
if ( $v_DebugMode ) { CMTraceLog -Message "... getting CM package: $($lPkgName)" -Type $TypeDebug }
$lCMRepoPackage = Get-CMPackage -Name $lPkgName -Fast
if ( $null -eq $lCMRepoPackage ) {
CMTraceLog -Message "... Package missing... Creating New" -Type $TypeNorm
$lCMRepoPackage = New-CMPackage -Name $lPkgName -Manufacturer "HP"
}
#--------------------------------------------------------------------------------
# update package with info from share folder
#--------------------------------------------------------------------------------
if ( $v_DebugMode ) { CMTraceLog -Message "... setting CM Package to Version: $($Script:v_OSVER), path: $($pRepoPath)" -Type $TypeDebug }
Set-CMPackage -Name $lPkgName -Version "$($Script:v_OSVER)"
Set-CMPackage -Name $lPkgName -Path $pRepoPath
if ( $Script:v_DistributeCMPackages ) {
CMTraceLog -Message "... updating CM Distribution Points"
update-CMDistributionPoint -PackageId $lCMRepoPackage.PackageID
}
$lCMRepoPackage = Get-CMPackage -Name $lPkgName -Fast # make sure we are woring with updated/distributed package
#--------------------------------------------------------------------------------
Set-Location -Path $pCurrentLoc
if ( $v_DebugMode ) { CMTraceLog -Message "< CM_RepoUpdate" -Type $TypeNorm }
} # Function CM_RepoUpdate
#=====================================================================================
<#
Function Get_ActivityLogEntries
obtains log entries from the ..\.Repository\activity.log file
... searches for last sync data
#>
Function Get_ActivityLogEntries {
[CmdletBinding()]
param( $pRepoFolder )
if ( (-not $RunUI) -and ($showActivityLog -eq $false) ) {
return
}
$ldotRepository = "$($pRepoFolder)\.Repository"
$lLastSync = $null
$lCurrRepoLine = 0
$lLastSyncLine = 0
if ( Test-Path $lDotRepository ) {
#--------------------------------------------------------------------------------
# find the last 'Sync started' entry
#--------------------------------------------------------------------------------
$lRepoLogFile = "$($ldotRepository)\$($s_HPIAActivityLog)"
if ( Test-Path $lRepoLogFile ) {
$find = 'sync has started' # look for this string in HPIA's log
(Get-Content $lRepoLogFile) |
Foreach-Object {
$lCurrRepoLine++
if ($_ -match $find) { $lLastSync = $_ ; $lLastSyncLine = $lCurrRepoLine }
} # Foreach-Object
CMTraceLog -Message " [activity.log - last sync @line $lLastSyncLine] $lLastSync " -Type $TypeWarn
} # if ( Test-Path $lRepoLogFile )
#--------------------------------------------------------------------------------
# now, $lLastSyncLine holds the log's line # where the last sync started
#--------------------------------------------------------------------------------
if ( $lLastSync ) {
$lLogFile = Get-Content $lRepoLogFile
for ( $i = 0; $i -lt $lLogFile.Count; $i++ ) {
if ( $i -ge ($lLastSyncLine-1) ) {
if ( ($lLogFile[$i] -match 'done downloading exe') -or
($lLogFile[$i] -match 'already exists') ) {
CMTraceLog -Message " [activity.log - Softpaq update] $($lLogFile[$i])" -Type $TypeWarn
}
if ( ($lLogFile[$i] -match 'Repository Synchronization failed') -or
($lLogFile[$i] -match 'ErrorRecord') -or
($lLogFile[$i] -match 'WebException') ) {
CMTraceLog -Message " [activity.log - Sync update] $($lLogFile[$i])" -Type $TypeError
}
}
} # for ( $i = 0; $i -lt $lLogFile.Count; $i++ )
} # if ( $lLastSync )
} # if ( Test-Path $lDotRepository )
} # Function Get_ActivityLogEntries
#=====================================================================================
<#
Function Backup_Log
Rename the file name in argument with .bak[0..99].log extention
Args:
$pLogFileFullPath: file to rename (as backup)
#>
Function Backup_Log {
[CmdletBinding()]
param( $pLogFileFullPath )
if ( Test-Path $pLogFileFullPath ) {
$lLogFileNameBase = [IO.Path]::GetFileNameWithoutExtension($pLogFileFullPath)
$lLogFileNameExt = [System.IO.Path]::GetExtension($pLogFileFullPath)
# log file exists, so back it up/rename it
for ($i=0; $i -lt 100; $i++ ) {
$lNewLogFilePath = $ScriptPath+'\'+$lLogFileNameBase+'.bak'+$i.ToString()+$lLogFileNameExt
if ( -not (Test-Path $lNewLogFilePath) ) {
CMTraceLog -Message "Renamed existing log file to $($lNewLogFilePath)" -Type $TypeNorm
$pLogFileFullPath | Rename-Item -NewName $lNewLogFilePath
return
} # if ( -not (Test-Path $lNewLogFilePath)
} # for ($i=0; $i -lt 100; $i++ )
} # if ( $pLogFileFullPath )
} # Function Backup_Log
#=====================================================================================
<#
Function init_repository
This function will create a repository folder
... and initialize it for HPIA, if arg $pInitialize = $True
Args:
$pRepoFOlder: folder to validate, or create
$pInitRepository: $true, initialize repository,
$false: do not initialize (used only as root of individual repository folders)
#>
Function init_repository {
[CmdletBinding()]
param( $pRepoFolder,
$pInitialize )
if ( $v_DebugMode ) { CMTraceLog -Message "> init_repository" -Type $TypeNorm }
$ir_CurrentLoc = Get-Location
# Make sure folder exists, or create it
if ( -not (Test-Path $pRepoFolder) ) {
Try {
$ir_ret = New-Item -Path $pRepoFolder -ItemType directory
CMTraceLog -Message "... repository path was not found, created: $pRepoFolder" -Type $TypeNorm
} Catch {
CMTraceLog -Message "... problem: $($_)" -Type $TypeError
}
} # if ( -not (Test-Path $pRepoFolder) )
switch ( $pInitialize ) {
$true {
if ( -not (test-path "$pRepoFolder\.Repository") ) {
Set-Location $pRepoFolder
$initOut = (Initialize-Repository) 6>&1
if ( $v_DebugMode ) { CMTraceLog -Message "... repository Initialized - $($Initout)" -Type $TypeNorm }
Set-RepositoryConfiguration -setting OfflineCacheMode -cachevalue Enable 6>&1
Set-RepositoryConfiguration -setting RepositoryReport -Format csv 6>&1
if ( $v_DebugMode ) { CMTraceLog -Message "... configuring $($pRepoFolder) for HP Image Assistant" -Type $TypeNorm }
} # if ( -not (test-path "$pRepoFolder\.Repository") )
# next, intialize .ADDSOFTWARE folder for holding named softpaqs
$ir_AddSoftpaqsFolder = "$($pRepoFolder)\$($s_AddSoftware)"
if ( -not (Test-Path $ir_AddSoftpaqsFolder) ) {
if ( $v_DebugMode ) { CMTraceLog -Message "... creating Add-on Softpaqs Folder $ir_AddSoftpaqsFolder" -Type $TypeNorm }
$lret = New-Item -Path $ir_AddSoftpaqsFolder -ItemType directory
} # if ( !(Test-Path $ir_AddSoftpaqsFolder) )
} # $true
$false {
if ( $v_DebugMode ) { CMTraceLog -Message "... Folder $($pRepoFolder) available" -Type $TypeNorm }
} # $false
} # switch ( $pInitialize )
if ( $v_DebugMode ) { CMTraceLog -Message "< init_repository" -Type $TypeNorm }
Set-Location $ir_CurrentLoc
} # Function init_repository
#=====================================================================================
<#
Function Download_Softpaq
This function will download a Softpaq, and its CVA and HTML associated files
if Softpaq previously downloaded, will not redownload, but the CVA dn HTML files are
Args:
$pSoftpaq: softpaq to download
$pAddOnFolderPath: folder to download files to
#>
Function Download_Softpaq {
param( $pSoftpaq,
$pAddOnFolderPath )
$da_CurrLocation = Get-Location
Set-Location $pAddOnFolderPath
$da_SoftpaqExePath = $pAddOnFolderPath+'\'+$pSoftpaq.id+'.exe'
if ( Test-Path $da_SoftpaqExePath ) {
CMTraceLog -Message "`t$($pSoftpaq.id) already downloaded - $($pSoftpaq.Name)" -Type $TypeWarn
} else {
CMTraceLog -Message "`tdownloading $($pSoftpaq.id)/$($pSoftpaq.Name)" -Type $TypeNoNewline
Try {
$ret = (Get-Softpaq $pSoftpaq.Id) 6>&1
CMTraceLog -Message "... done" -Type $TypeNorm
} Catch {
CMTraceLog -Message "... failed to download: $($_)" -Type $TypeError
}
} # else if ( Test-Path $da_SoftpaqExePath ) {
# download corresponding CVA file
CMTraceLog -Message "`tdownloading $($pSoftpaq.id) CVA file" -Type $TypeNoNewline
Try {
$ret = (Get-SoftpaqMetadataFile $pSoftpaq.Id -Overwrite 'Yes') 6>&1 # ALWAYS update the CVA file, even if previously downloaded
CMTraceLog -Message "... done" -Type $TypeNorm
} Catch {
CMTraceLog -Message "... failed to download: $($_)" -Type $TypeError
}
# download corresponding HTML file
CMTraceLog -Message "`tdownloading $($pSoftpaq.id) HTML file" -Type $TypeNoNewline
Try {
$da_SoftpaqHtml = $pAddOnFolderPath+'\'+$pSoftpaq.id+'.html' # where to download to
$ret = Invoke-WebRequest -UseBasicParsing -Uri $pSoftpaq.ReleaseNotes -OutFile "$da_SoftpaqHtml"
CMTraceLog -Message "... done" -Type $TypeNorm
} Catch {
CMTraceLog -Message "... failed to download" -Type $TypeError
}
Set-Location $da_CurrLocation
} # Function Download_Softpaq
Function Get_Softpaqs {
[CmdletBinding()]
param( $pAddOnFlagFileFullPath )
$gs_ProdCode = Split-Path $pAddOnFlagFileFullPath -leaf
$gs_AddSoftpaqsFolder = Split-Path $pAddOnFlagFileFullPath -Parent
[array]$gs_AddOnsList = Get-Content $pAddOnFlagFileFullPath
if ( $gs_AddOnsList.count -ge 1 ) {
CMTraceLog -Message "... platform $($gs_ProdCode): checking AddOns flag file"
if ( $v_DebugMode ) { CMTraceLog -Message 'calling Get-SoftpaqList():'+$gs_ProdCode -Type $TypeNorm }
Try {
$gs_SoftpaqList = (Get-SoftpaqList -platform $gs_ProdCode -os $Script:v_OS -osver $Script:v_OSVER -characteristic SSM) 6>&1
# check every reference file Softpaq for a match in the flg file list
ForEach ( $gs_iEntry in $gs_AddOnsList ) {
$gs_EntryFound = $False
CMTraceLog -Message "... Checking AddOn Softpaq by name: $($gs_iEntry)" -Type $TypeNorm
CMTraceLog -Message "... # entries in ref file: $($gs_iEntry.Count)" -Type $TypeNorm
ForEach ( $gs_iSoftpaq in $gs_SoftpaqList ) {
if ( [string]$gs_iSoftpaq.Name -match $gs_iEntry ) {
$gs_EntryFound = $True
CMTraceLog -Message "... calling Download_Softpaq(): $($gs_iEntry)"
Download_Softpaq $gs_iSoftpaq $gs_AddSoftpaqsFolder
} # if ( [string]$gs_iSoftpaq.Name -match $gs_iEntry )
} # ForEach ( $gs_iSoftpaq in $gs_SoftpaqList )
if ( -not $gs_EntryFound ) {
CMTraceLog -Message "... '$($gs_iEntry)': Softpaq not found for this platform and OS version" -Type $TypeWarn
} # if ( -not $gs_EntryFound )
} # ForEach ( $lEntry in $gs_AddOnsList )
} Catch {
CMTraceLog -Message "... $($gs_ProdCode): Error retrieving Reference file" -Type $TypeError
}
} else {
CMTraceLog -Message $gs_ProdCode': Flag file found but empty '
} # else if ( -not ([String]::IsNullOrWhiteSpace($lAddOns)) )
} # Function Get_Softpaqs
#=====================================================================================
<#
Function Download_AddOns
designed to find named Softpaqs from $HPModelsTable and download those into their own repo folder
Requires: pGrid - entries from the UI grid devices
pFolder - repository folder to check out
pCommonRepoFlag - check for using Common repo for all devices
#>
Function Download_AddOns {
[CmdletBinding()]
param( $pGrid,
$pFolder,
$pCommonRepoFlag )
if ( $script:noIniSw ) { return } # $script:noIniSw = runstring option, if executed from command line
$da_CurrentLoc = Get-Location
$da_AddSoftpaqsFolder = "$($pFolder)\$($s_AddSoftware)" # get path of .ADDSOFTWARE subfolder
Set-Location $da_AddSoftpaqsFolder
switch ( $pCommonRepoFlag ) {
#--------------------------------------------------------------------------------
# Download AddOns for every device with flag file content
#--------------------------------------------------------------------------------
$true {
#--------------------------------------------------------------------------------
# There are potentially multiple models being held in this repository
# ... so find all Platform AddOns flag files for content defined by user
#--------------------------------------------------------------------------------
for ( $iRow = 0; $iRow -lt $pGrid.RowCount; $iRow++ ) {
$da_ProdCode = $pGrid[1,$iRow].Value # column 1 = Model/Prod ID
$da_ModelName = $pGrid[2,$iRow].Value # column 2 = Model name
$lAddOnsFlag = $pGrid.Rows[$iRow].Cells['AddOns'].Value # column 7 = 'AddOns' checkmark
$lProdIDFlagFile = $da_AddSoftpaqsFolder+'\'+$da_ProdCode
# if user checked the addOns column... and the flag file is there...
if ( $lAddOnsFlag -and (Test-Path $lProdIDFlagFile) ) {
if ( $v_DebugMode ) { CMTraceLog -Message 'Flag file found:'+$lAddOnsFlagFile -Type $TypeWarn }
Get_Softpaqs $lAddOnsFlagFile
<#
[array]$da_AddOnsList = Get-Content $lProdIDFlagFile
if ( $da_AddOnsList.count -ge 1 ) {
CMTraceLog -Message "... platform $($da_ProdCode): checking AddOns flag file"
if ( $v_DebugMode ) { CMTraceLog -Message 'calling Get-SoftpaqList():'+$da_ProdCode -Type $TypeNorm }
Try {
$da_SoftpaqList = (Get-SoftpaqList -platform $da_ProdCode -os $Script:v_OS -osver $Script:v_OSVER -characteristic SSM) 6>&1
# check every reference file Softpaq for a match in the flg file list
ForEach ( $da_iEntry in $da_AddOnsList ) {
$da_EntryFound = $False
CMTraceLog -Message "... Checking AddOn Softpaq by name: $($da_iEntry)" -Type $TypeNorm
CMTraceLog -Message "... # entries in ref file: $($da_iEntry.Count)" -Type $TypeNorm
ForEach ( $iSoftpaq in $da_SoftpaqList ) {
if ( [string]$iSoftpaq.Name -match $da_iEntry ) {
$da_EntryFound = $True
CMTraceLog -Message "... calling Download_Softpaq(): $($da_iEntry)"
Download_Softpaq $iSoftpaq $da_AddSoftpaqsFolder
} # if ( [string]$iSoftpaq.Name -match $da_iEntry )
} # ForEach ( $iSoftpaq in $da_SoftpaqList )
if ( -not $da_EntryFound ) {
CMTraceLog -Message "... '$($da_iEntry)': Softpaq not found for this platform and OS version" -Type $TypeWarn
} # if ( -not $da_EntryFound )
} # ForEach ( $lEntry in $da_AddOnsList )
} Catch {
CMTraceLog -Message "... $($da_ProdCode): Error retrieving Reference file" -Type $TypeError
}
} else {
CMTraceLog -Message $da_ProdCode': Flag file found but empty '
} # else if ( -not ([String]::IsNullOrWhiteSpace($lAddOns)) )
#>
} else {
CMTraceLog -Message '... '$da_ProdCode': AddOns cell not checked, will not attempt to download'
} # else if (Test-Path $lAddOnsFlagFile)
} # for ( $i = 0; $i -lt $pGrid.RowCount; $i++ )
} # $true
$false { # Download AddOns for individual models ( $pCommonRepoFlag = $false )
#--------------------------------------------------------------------------------
# Search grid for SysID, so we can find the AddOns flag file, and check it
#--------------------------------------------------------------------------------
for ( $i = 0; $i -lt $pGrid.RowCount; $i++ ) {
$da_SystemID = $pGrid[1,$i].Value # column 1 has the Model/Prod ID
$lSystemName = $pGrid[2,$i].Value # column 2 has the Model name
$lFoldername = split-path $pFolder -Leaf
if ( $lFoldername -match $lSystemName ) { # we found the model, so get the Prod ID
$da_AddOnsValue = $pGrid.Rows[$i].Cells['AddOns'].Value # column 7 has the AddOns checkmark
$lProdIDFlagFile = $da_AddSoftpaqsFolder+'\'+$da_SystemID
if ( $da_AddOnsValue -and (Test-Path $lProdIDFlagFile) ) {
if ( $v_DebugMode ) { CMTraceLog -Message 'Flag file found:'+$lProdIDFlagFile -Type $TypeWarn }
Get_Softpaqs $lProdIDFlagFile
<#
[array]$da_AddOnsList = Get-Content $lProdIDFlagFile
if ( $da_AddOnsList.count -ge 1 ) {
CMTraceLog -Message " ... AddOns Softpaq entries: $($da_AddOnsList)" -Type $TypeNorm
Try {
$da_SoftpaqList = (Get-SoftpaqList -platform $da_SystemID -os $Script:v_OS -osver $Script:v_OSVER -characteristic SSM) 6>&1
ForEach ( $da_iEntry in $da_AddOnsList ) { # search available Softpaq for a match
$da_EntryFound = $False
$da_SoftpaqList | foreach {
if ( $_.Name -match $da_iEntry ) {
$da_EntryFound = $true
CMTraceLog -Message " ... Downloading AddOn Softpaq: $($_.Name)"
Download_Softpaq $_ $da_AddSoftpaqsFolder
} # if ( $_.Name -match $da_iEntry )
} # $da_SoftpaqList | foreach
if ( -not $da_EntryFound ) {
CMTraceLog -Message " ... AddOn Softpaq by name not found: $($da_iEntry)"
}
} # ForEach ( $lEntry in $da_AddOnsList )
} Catch {
CMTraceLog -Message " ... $($da_SystemID): Error retrieving Reference file" -Type $TypeError
}
} else {
CMTraceLog -Message ' ... '$da_SystemID': AddOn flag file found but empty'
} # else if ( $da_AddOnsList.count -ge 1 )
#>
} # if ( $da_AddOnsValue -and (Test-Path $lProdIDFlagFile) )
} # if ( $lFoldername -match $lSystemName )
} # for ( $i = 0; $i -lt $pGrid.RowCount; $i++ )
} # false
} # switch ( $pCommonRepoFlag )
Set-Location $da_CurrentLoc
} # Function Download_AddOns
#=====================================================================================
<#
Function Restore_AddOns
This function will restore softpaqs from .ADDSOFTWARE to root
expects Parameter
- Repository folder to sync
#>
Function Restore_AddOns {
[CmdletBinding()]
param( $pFolder,
$pAddSoftpaqs ) # $True = restore Softpaqs to repo from .ADDSOTWARE folder
if ( $pAddSoftpaqs ) {
CMTraceLog -Message "... Restoring named softpaqs/cva files to Repository"
$ras_source = "$($pFolder)\$($s_AddSoftware)\*.*"
Copy-Item -Path $ras_source -Filter *.cva -Destination $pFolder
Copy-Item -Path $ras_source -Filter *.exe -Destination $pFolder
Copy-Item -Path $ras_source -Filter *.html -Destination $pFolder
CMTraceLog -Message "... Restoring named softpaqs/cva files completed"
} # if ( -not $noIniSw )
} # Restore_AddOns
#=====================================================================================
<#
Function Sync_and_Cleanup_Repository
This function will run a Sync and a Cleanup commands from HPCMSL
Parameter
- pGrid
- Repository folder to sync
- Flag : True if this is a common repo, False if an individual repo
#>
Function Sync_and_Cleanup_Repository {
[CmdletBinding()]
param( $pGrid, $pFolder, $pCommonFlag )
$scr_CurrentLoc = Get-Location
CMTraceLog -Message " >> Sync_and_Cleanup_Repository - '$pFolder' - please wait !!!" -Type $TypeNorm
if ( Test-Path $pFolder ) {
#--------------------------------------------------------------------------------
# update repository softpaqs with sync command and then cleanup
#--------------------------------------------------------------------------------
Set-Location -Path $pFolder
Try {
CMTraceLog -Message '... calling CMSL Invoke-RepositorySync' -Type $TypeNorm
$lres = invoke-repositorysync 6>&1
# find what sync'd from the CMSL log file for this run
try {
CMTraceLog -Message '... retrieving repository filters' -Type $TypeNorm
#$lRepoFilters = (Get-RepositoryInfo).Filters # see if any filters are used to continue
Get_ActivityLogEntries $pFolder # get sync'd info from HPIA activity log file
$sc_contentsFile = "$($pFolder)\.repository\contents.csv"
if ( Test-Path $sc_contentsFile ) {
$lContentsHASH = (Get-FileHash -Path "$($pFolder)\.repository\contents.csv" -Algorithm SHA256).Hash
if ( $v_DebugMode ) { CMTraceLog -Message "... SHA256 Hash of 'contents.csv': $($lContentsHASH)" -Type $TypeWarn }
}
#--------------------------------------------------------------------------------
CMTraceLog -Message '... calling CMSL invoke-RepositoryCleanup' -Type $TypeNorm
invoke-RepositoryCleanup 6>&1
CMTraceLog -Message '... calling Download_AddOns()' -Type $TypeNorm
Download_AddOns $pGrid $pFolder $pCommonFlag
CMTraceLog -Message '... calling Restore_Softpaqs()' -Type $TypeNorm
Restore_AddOns $pFolder (-not $script:noIniSw)
#--------------------------------------------------------------------------------
# see if Cleanup modified the contents.csv file
# - seems like (up to at least 1.6.3) RepositoryCleanup does not Modify 'contents.csv'
if ( Test-Path $sc_contentsFile ) {
$lContentsHASH = Get_SyncdContents $pFolder # Sync command creates 'contents.csv'
CMTraceLog -Message "... MD5 Hash of 'contents.csv': $($lContentsHASH)" -Type $TypeWarn
}
} catch {
$lContentsHASH = $null
}
} Catch {
CMTraceLog -Message "... error w/Sync $_" -Type $TypeError
} # Catch Try
CMTraceLog -Message ' << Sync_and_Cleanup_Repository - Done' -Type $TypeNorm
} # if ( Test-Path $pFolder )
Set-Location $scr_CurrentLoc
} # Function Sync_and_Cleanup_Repository
#=====================================================================================
<#
Function Update_Model_Filters
for the selected model:
- remove all filters
- add filters as selected in UI
******* TBD: Add Platform AddOns file to .ADDSOFTWARE
#>
Function Update_Model_Filters {
[CmdletBinding()]
param( $pGrid,
$pModelRepository,
$pModelID,
$pRow )
$umf_CurrentLoc = Get-Location
set-location $pModelRepository
if ( $Script:v_Continueon404 ) {
Set-RepositoryConfiguration -Setting OnRemoteFileNotFound -Value LogAndContinue
} else {
Set-RepositoryConfiguration -Setting OnRemoteFileNotFound -Value Fail
}
#--------------------------------------------------------------------------------
# now update filters for every category checked for the current model'
#--------------------------------------------------------------------------------
if ( $v_DebugMode ) { CMTraceLog -Message "... adding category filters" -Type $TypeDebug }
foreach ( $cat in $Script:v_FilterCategories ) {
if ( $pGrid.Rows[$pRow].Cells[$cat].Value ) {
CMTraceLog -Message "... adding filter: -Platform $pModelID -os $Script:v_OS:$Script:v_OSVER -category $($cat) -characteristic ssm" -Type $TypeNoNewline
$lRes = (Add-RepositoryFilter -platform $pModelID -os $Script:v_OS -osver $Script:v_OSVER -category $cat -characteristic ssm 6>&1)
CMTraceLog -Message $lRes -Type $TypeWarn
} # if ( $pGrid.Rows[$pRow].Cells[$cat].Value )
} # foreach ( $cat in $Script:v_FilterCategories )
#--------------------------------------------------------------------------------
# update repository path field for this model in the grid (path is the last col)
#--------------------------------------------------------------------------------
$pGrid[($pGrid.ColumnCount-1),$pRow].Value = $pModelRepository
Set-Location -Path $umf_CurrentLoc
} # Update_Model_Filters
#=====================================================================================
<#
Function Sync_Repos
This function is used for command-line execution
#>
Function Sync_Repos {
[CmdletBinding()]
param( $pGrid, $pCommonRepoFlag )
$lCurrentSetLoc = Get-Location
#--------------------------------------------------------------------------------
# find out if the share exists, if not, just return
#--------------------------------------------------------------------------------
if ( $pCommonRepoFlag ) {
# basic check to confirm the repository was configured for HPIA
if ( !(Test-Path "$($Script:v_Root_CommonRepoFolder)\.Repository") ) {
CMTraceLog -Message "... Common Repository Folder selected, not initialized" -Type $TypeNorm
return
}
set-location $Script:v_Root_CommonRepoFolder
Sync_and_Cleanup_Repository $pGrid $Script:v_Root_CommonRepoFolder $pCommonRepoFlag
} else {
# basic check to confirm the repository exists that hosts individual repos
if ( Test-Path $Script:v_Root_IndividualRepoFolder ) {
# let's traverse every product Repository folder
$lProdFolders = Get-ChildItem -Path $Script:v_Root_IndividualRepoFolder | Where-Object {($_.psiscontainer)}
foreach ( $lprodName in $lProdFolders ) {
$lCurrentPath = "$($Script:v_Root_IndividualRepoFolder)\$($lprodName.name)"
set-location $lCurrentPath
Sync_and_Cleanup_Repository $pGrid $lCurrentPath $pCommonRepoFlag
} # foreach ( $lprodName in $lProdFolders )
} else {
CMTraceLog -Message "... Shared/Individual Repository Folder selected, Head repository not initialized" -Type $TypeNorm
} # else if ( !(Test-Path $Script:v_Root_IndividualRepoFolder) )
} # else if ( $Script:v_CommonRepo )
CMTraceLog -Message "Sync DONE" -Type $TypeSuccess
Set-Location -Path $lCurrentSetLoc
} # Sync_Repos
#=====================================================================================
<#
Function sync_individualRepositories
for every selected model, go through every repository by model
- ensure there is a valid repository
- remove all filters
- add filters as selected in UI
- invoke sync and cleanup function on each folder
#>
Function sync_individualRepositories {
[CmdletBinding()]
param( $pGrid,
$pRepoHeadFolder,
$pCheckedItemsList,
$pNewModels ) # $True = models added to list) # array of rows selected