|
37 | 37 | )] |
38 | 38 | [string[]] $ReplaceStrings, |
39 | 39 | # The new targets need names that can identify the them, so we don't reuse the same name as the outdated target |
40 | | - # Please note, that this array must be size 1 our the same count as replace strings, otherwise an error will be thrown |
| 40 | + # Please note, that this array must be size 1 or the same count as ReplaceStrings, otherwise an error will be thrown |
41 | 41 | #> |
42 | 42 | [Parameter( |
43 | 43 | Position = 3, |
|
53 | 53 | Mandatory = $false, |
54 | 54 | ParameterSetName = 'byMSSession' |
55 | 55 | )] |
56 | | - [string[]] $Fingerprints |
| 56 | + [string[]] $Fingerprints, |
| 57 | + # If included an given, the replacemenet will only be done in the projects with the given name |
| 58 | + #> |
| 59 | + [Parameter( |
| 60 | + Position = 5, |
| 61 | + Mandatory = $false, |
| 62 | + ParameterSetName = 'byMSSession' |
| 63 | + )] |
| 64 | + [string[]] $InProjects |
57 | 65 | ) |
58 | 66 | begin { |
59 | 67 | Write-Debug -Message ("[ Enter => function {0} ]" -f $MyInvocation.MyCommand); |
|
82 | 90 | foreach ($Project in $Projects) |
83 | 91 | { |
84 | 92 | $ProjectName = $Project.name |
85 | | - # TODO - Remove start |
86 | | - if ($ProjectName -ne "FastTrackTest1") |
| 93 | + if ($InProjects.Length -gt 0 -and $InProjects.Contains($ProjectName)) |
87 | 94 | { |
88 | 95 | continue |
89 | 96 | } |
90 | | - # TODO - Remove end |
91 | 97 |
|
92 | 98 | $Report.Add($ProjectName, @()) |
93 | 99 |
|
94 | 100 | # Inhibitlevel tells us about the lock level of the system and |
95 | 101 | # -1 stands for "Locked to all users including Server Manager" |
96 | | - # so since we can't access the projec tanyway, we can skip it. |
| 102 | + # so since we can't access the project anyway, we can skip it. |
97 | 103 | if ($Project.inhibitlevel -eq -1) { |
98 | 104 | $Report[$ProjectName] += "Project is locked. Skipping..." |
99 | 105 | continue; |
|
108 | 114 | $OutDatedTargetGuid = $null |
109 | 115 | # This map will hold information about the target (url) and the GUID the target will have |
110 | 116 | $NewTargets = @{} |
111 | | - # Whereas this map will hold information about the target (url) and whether there exists a publication combination already |
| 117 | + # Whereas this map will hold information about the target (url) and whether there exists a publication |
| 118 | + # combination already |
112 | 119 | $PublicationCombinationMap = @{} |
113 | 120 | foreach ($ReplaceString in $ReplaceStrings) |
114 | 121 | { |
115 | | - # This is just a map for better performance when |
| 122 | + # This is just a map for better performance when going over the same target that doesn't need |
| 123 | + # replacing multiple times, so we don't iterate over it more than once. |
116 | 124 | $NewTargets.Add($ReplaceString, $null); |
117 | 125 | $PublicationCombinationMap.Add($ReplaceString, $false); |
118 | 126 | } |
|
251 | 259 | } |
252 | 260 | } |
253 | 261 |
|
254 | | - $Report[$ProjectName] += "Added $AddedCounter new combinations in this project" |
| 262 | +# $Report[$ProjectName] += "Added $AddedCounter new combinations in this project" |
255 | 263 | } |
256 | 264 |
|
257 | 265 | return $Report |
|
0 commit comments