Skip to content

Commit

Permalink
Merge pull request #2094 from microsoft/dpaul-VssTesterDev
Browse files Browse the repository at this point in the history
Handle list writers starting at different index
  • Loading branch information
dpaulson45 authored Jun 13, 2024
2 parents 5a60c90 + 5ad52e6 commit c39731b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Databases/VSSTester/Logging/Get-VSSWriter.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ function Get-VSSWriter {
throw "Unable to list vss writers"
}

for ($lineNumber = 3; $lineNumber -lt $writersText.Count; $lineNumber += 6) {
$startIndex = 3

if (-not ($writersText[$startIndex] -like "Writer name*")) {
Write-Host "Finding the first writer..."
for ($lineNumber = $startIndex; $lineNumber -lt $writersText.Count; $lineNumber++) {
if ($writersText[$lineNumber] -like "Writer name*") {
$startIndex = $lineNumber
break
}
}
}

for ($lineNumber = $startIndex; $lineNumber -lt $writersText.Count; $lineNumber += 6) {
[PSCustomObject]@{
Name = $writersText[$lineNumber].Substring($writersText[$lineNumber].IndexOf("'") + 1).TrimEnd("'")
Id = $writersText[$lineNumber + 1].Substring($writersText[$lineNumber + 1].IndexOf("{") + 1).TrimEnd("}")
Expand Down

0 comments on commit c39731b

Please sign in to comment.